Quantcast
Channel: Flexera Community Forums
Viewing all articles
Browse latest Browse all 4553

Unexpected behaviour of ParsePath function

$
0
0
I'm creating a custom recordfile that should be specified as command-line parameter to setup.exe.

Code:
Code:

szcondition="record="; //condition
szParameter=CMDLINE;    //passing parameter from command line to variable

MessageBox (szParameter, INFORMATION); //debug message

nPlace=StrFind(szParameter,szcondition); //if string entered correctly this will return 0 or more;
//checking

if (nPlace >= 0)  then
       
        //parsing string
       
        StrSub(szPath,szParameter,nPlace+7,99); //finding path substring
        StrReplace (szPath, "\"", "",0); //removing " from path if any
        ParsePath (szDir, szPath, PATH);  //parsing input for directory
        ParsePath (szFile, szPath, FILENAME);  //parsing input for filename
        MessageBox (szDir^szFile, INFORMATION); //debug message
        OpenFileMode (FILE_MODE_APPEND);
        if (CreateFile (nFileHandle, szDir, szFile) < 0) then
        MessageBox ("Creating failed.", SEVERE);
        abort;
    else
                MessageBox ("Your file was created", INFORMATION);
                exit;

Everything works fine in cases:
1. setup.exe record=c:\path\to\file.txt
2. setup.exe record="c:\path\to\file.txt"

....but fails in case:
setup.exe record="c:\path\to\file.txt

...in that case, following result happens (second messagebox):
c:\path\to\file.txt -sel_lang0409

Is there any way to avoid such behavior, except specifically tell user to enter either zero or both ""?

Viewing all articles
Browse latest Browse all 4553

Trending Articles