CanonizePath, Windows, network drive

Report any Hollywood bugs here
Post Reply
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

CanonizePath, Windows, network drive

Post by Flinx »

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.

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$)
Result (only the first one is ok):

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
Ralf
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: CanonizePath, Windows, network drive

Post by airsoftsoftwair »

Thanks for the report, will be fixed.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: CanonizePath, Windows, network drive

Post by airsoftsoftwair »

Code: Select all

- Fix [Windows]: CanonizePath() didn't work correctly with network paths
Post Reply