<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi developers,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Calling ConvertToOutputPath() on windows converts all slashes to windows slashes, and also double quotes the path when a space is present in it.<o:p></o:p></p>
<p class="MsoNormal">The latter causes issues when feeding the corrected path name to functions such as FileIsDirectory() or JoinPath().<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For example I have the path: D:/tmp/New folder\<o:p></o:p></p>
<p class="MsoNormal">I feed it to ConvertToOutputPath and get: "D:\tmp\New folder\"<o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Which leads me to conclude that on Windows the functions ConvertToOutputPath and FileIsDirectory are incompatible.<o:p></o:p></p>
<p class="MsoNormal">There is also this issue with JoinPath() and possibly also with FileExists().<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I added a test program to demonstrate the behaviour, see attachment.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Looking for some feedback, regards, Marius<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">Marius Staring, PhD<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">Division of Image Processing (LKEB)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">Department of Radiology<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">Leiden University Medical Center<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">PO Box 9600, 2300 RC Leiden, The Netherlands<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">m.staring@lumc.nl<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>