Add as Link does not use relative path when root is the only common directory


Given project file C:\Foo\Bar\Bar.pyproj, when doing Add Existing File ->Add as Link, if the added file only has the root directory in common - e.g. C:\Baz\Baz.py - the file is not added using relative path ....\Baz\Baz.py as expected, but rather using absolute path with no drive letter: \Baz\Baz.py. This causes other issues, because the project system does not expect to deal with such paths which are neither relative nor full - e.g. when trying to set such a file as a startup file, the operation fails with an error message.

If there is at least one directory other than \ in common, then the file is correctly added with a relative path. E.g. when adding C:\Foo\Baz\baz.py, it is added as ..\Baz\foo.py.

We need to either use a full path (with drive letter), or generate the correct relative path in all cases.

C# projects always use relative paths if the file is on the same drive. Absolute paths are only used when the file is on a different drive.


pminaev wrote Jan 8 at 7:49 PM