[Insight-developers] Bug in SystemTools due to ConvertToOutputPath on Windows?

M.Staring at lumc.nl M.Staring at lumc.nl
Tue Dec 11 04:24:12 EST 2012


Hi developers,

Calling ConvertToOutputPath() on windows converts all slashes to windows slashes, and also double quotes the path when a space is present in it.
The latter causes issues when feeding the corrected path name to functions such as FileIsDirectory() or JoinPath().

For example I have the path:  D:/tmp/New folder\
I feed it to ConvertToOutputPath and get: "D:\tmp\New folder\"
If I then call FileIsDirectory( path ), making sure that it exists, the function FileIsDirectory will check for the path FileIsDirectory()"D:\tmp\New folder\" which does not exist. However, the path D:\tmp\New folder\ (no quotes) does exist.

Which leads me to conclude that on Windows the functions ConvertToOutputPath and FileIsDirectory are incompatible.
There is also this issue with JoinPath() and possibly also with FileExists().

I added a test program to demonstrate the behaviour, see attachment.

I am not sure about the solution, but I guess JointPath and FileExists should unquote (if quotes are present) on windows before further processing. But maybe this was intended behaviour?

Looking for some feedback, regards, Marius

Marius Staring, PhD
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands
phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256
m.staring at lumc.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20121211/3d2b0dee/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20121211/3d2b0dee/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testPaths.cxx
Type: application/octet-stream
Size: 1773 bytes
Desc: testPaths.cxx
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20121211/3d2b0dee/attachment.obj>


More information about the Insight-developers mailing list