Skip to content

[Fix] Correct pathDirname output for root-level directories#6142

Merged
nathanlesage merged 2 commits into
Zettlr:developfrom
benniekiss:win-path-detection
Jan 20, 2026
Merged

[Fix] Correct pathDirname output for root-level directories#6142
nathanlesage merged 2 commits into
Zettlr:developfrom
benniekiss:win-path-detection

Conversation

@benniekiss

Copy link
Copy Markdown
Collaborator

Description

This PR fixes an issue with pathDirname which was stripping the final path separator if the provided path was a root-level path, such as C:\Notes or /notes, which would be returned as C: or ``

Closes #6105

Changes

A check was added to pathDirname to ensure the final path separator is not removed by first checking if the path is absolute and whether the first and last found path separator are at the same position.

Two test cases were added which failed before the patches.

Additional information

I would appreciate verification on a windows platform if this fixes issues related to search. I do not have a windows machine.

Tested on: macOS 26

@nathanlesage

Copy link
Copy Markdown
Member

Ah gracias, and that should correctly give us back search for windows users who have a workspace at a volume root, correct?

@benniekiss

Copy link
Copy Markdown
Collaborator Author

I'm pretty confident it will, but I cannot confirm myself since I dont have a windows machine

@nathanlesage

Copy link
Copy Markdown
Member

That's what unit tests are for 😎 I'd argue we yolo it and then let users test a manual nightly! I'll merge in a few moments

@benniekiss

Copy link
Copy Markdown
Collaborator Author

couldnt agree more!

@nathanlesage nathanlesage merged commit 73b50cc into Zettlr:develop Jan 20, 2026
1 check passed
@benniekiss benniekiss deleted the win-path-detection branch January 20, 2026 22:19
benniekiss added a commit to benniekiss/Zettlr that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search accross all files no longer gives any result

2 participants