Skip to content

fix subst drive paths on Windows - #126

Merged
ElMassimo merged 2 commits into
bgreenlee:masterfrom
adamkerz:fix_subst_drive_windows
Sep 29, 2026
Merged

ElMassimo merged 2 commits into
bgreenlee:masterfrom
adamkerz:fix_subst_drive_windows

Conversation

@adamkerz

Copy link
Copy Markdown

On Windows, if you use subst to create a new drive from a subpath of another drive, some software resolves paths back to the previous drive and others don't.

Sublime doesn't, but git does, it appears.

Eg:
D:\development\my_repo\architecture\models.py in Sublime gets turned into C:\d_drive\development\my_repo\architecture\models.py by git. To be more correct, running git rev-parse --show-toplevel returns C:\d_drive\development\my_repo which is clearly NOT a prefix of D:\development\my_repo\architecture\models.py and this breaks the relative file path calc in the RemoteUrlCommands.

@adamkerz

Copy link
Copy Markdown
Author

Unfortunately, os.path.realpath DIDN'T resolve the path through subst paths until python3.8, so this necessitates an "upgrade" to py3.8, meaning Sublime4+ support only. Technically, the plugin should still work fine on older versions of sublime as the os.path function still exists and the .python-version file is ignored, but the bug won't be fixed on older versions. This is the obscure end of an obscure wedge...

adamkerz and others added 2 commits September 29, 2026 15:24
Retain the opened file name, canonicalize parent directories only when Git reports a different root, and exercise subst drive mapping on Windows CI.
@ElMassimo
ElMassimo force-pushed the fix_subst_drive_windows branch from 155f352 to 4cd4de7 Compare September 29, 2026 18:27
@ElMassimo

ElMassimo commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Made a change so that the path calculation keeps the opened filename and only canonicalizes parent directories when the file cannot be made relative to Git’s reported root (such as a Windows subst drive).

Added regression coverage for file symlinks and directory aliases, plus a Windows Actions job that creates an actual subst drive and tests the Git root and physical-path cases.

@ElMassimo
ElMassimo merged commit 93c71e9 into bgreenlee:master Sep 29, 2026
3 checks passed
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.

2 participants