Skip to content

Commit 20ef1cf

Browse files
committed
fix: improve current directory name retrieval in FileTreeHeader
- Enhanced the getCurrentDirectoryName function to support both Unix (/) and Windows (\) path separators for better compatibility. - Updated logic to split the currentFolder string using a regular expression, ensuring accurate extraction of the directory name.
1 parent 9ee3264 commit 20ef1cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/filetree/FileTreeHeader.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export function FileTreeHeader({
2929
}, [showSearchInput]);
3030
const getCurrentDirectoryName = () => {
3131
if (!currentFolder) return "Home";
32-
return currentFolder.split("/").pop() || currentFolder;
32+
// Support both Unix (/) and Windows (\) path separators
33+
const parts = currentFolder.split(/[/\\]+/);
34+
return parts.pop() || currentFolder;
3335
};
3436

3537
return (

0 commit comments

Comments
 (0)