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
[email protected]

# This project is intended to be built outside the Insight source tree
PROJECT( testPaths )

CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )


# Find ITK.
FIND_PACKAGE( ITK REQUIRED )
INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE( testPaths testPaths.cxx )

TARGET_LINK_LIBRARIES( testPaths ${ITK_LIBRARIES})

Attachment: testPaths.cxx
Description: testPaths.cxx

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers

Reply via email to