CanonizePath, Windows, network drive
Posted: Tue Jan 11, 2022 5:27 pm
While trying some things with OnDropFile, I noticed that the CanonizePath() function does not work in certain locations. This happens here with the NAS function of my internet router, but only with some folders of the mapped drive. I did not found the effect with other network connections.
It's not clear to me what the difference is between the paths that work and the ones that don't.
Here are some examples. When it does not work, it always returns a broken UNC path.
This is Windows 10, 64 bit.
Even though I don't really have a problem with this, I wanted to report it.
Result (only the first one is ok):
Ralf
It's not clear to me what the difference is between the paths that work and the ones that don't.
Here are some examples. When it does not work, it always returns a broken UNC path.
This is Windows 10, 64 bit.
Even though I don't really have a problem with this, I wanted to report it.
Code: Select all
Function CanonizeTest(f$)
If Exists(f$) Then DebugPrint("\nfile exists:") Else DebugPrint("\nfile doesn't exist:")
DebugPrint(f$)
DebugPrint(PathPart(f$))
DebugPrint(CanonizePath(PathPart(f$)))
EndFunction
Filename$="N:\\a\\b\\c\\d\\e\\f\\g\\test.txt"
CanonizeTest(Filename$)
Filename$="N:\\aa\\bb\\cc\\dd\\ee\\ff\\gg\\test.txt"
CanonizeTest(Filename$)
Filename$="N:\\aaaaaa\\bbbbbb\\cccccc\\dddddd\\eeeeee\\ffffff\\gggggg\\test.txt"
CanonizeTest(Filename$)
Filename$="N:\\test1\\test2\\test3\\test.txt"
CanonizeTest(Filename$)
Filename$="N:\\test1\\test2\\test3\\test4\\test.txt"
CanonizeTest(Filename$)
Filename$="N:\\test1b\\test2\\test3\\test4\\test5\\test6\\test7\\test.txt"
CanonizeTest(Filename$)
Code: Select all
file exists:
N:\a\b\c\d\e\f\g\test.txt
N:\a\b\c\d\e\f\g\
N:\a\b\c\d\e\f\g\
file exists:
N:\aa\bb\cc\dd\ee\ff\gg\test.txt
N:\aa\bb\cc\dd\ee\ff\gg\
\\fritz.nas\fritz.nas\aa
file exists:
N:\aaaaaa\bbbbbb\cccccc\dddddd\eeeeee\ffffff\gggggg\test.txt
N:\aaaaaa\bbbbbb\cccccc\dddddd\eeeeee\ffffff\gggggg\
\\fritz.nas\fritz.nas\a\dddddd\eeeeee\ffffff\gggggg\
file doesn't exist:
N:\test1\test2\test3\test.txt
N:\test1\test2\test3\
\\fritz.nas\fritz.nas
file exists:
N:\test1\test2\test3\test4\test.txt
N:\test1\test2\test3\test4\
\\fritz.nas\fritz.nas\test1
file exists:
N:\test1b\test2\test3\test4\test5\test6\test7\test.txt
N:\test1b\test2\test3\test4\test5\test6\test7\
\\fritz.nas\fritz.nas\test1b\test2\test3\test4