It seems that ExecPFF does not understand relative paths.
I tried:
execpff("..\..\folder\file.xtb.pff");
execpff("..\\..\\folder\\file.xtb.pff");
execpff("../../folder/file.xtb.pff");
execsystem('C:\Program Files (x86)\CSPro 4.1\runpff.exe "..\..\folder\file.xtb.pff"');
None of them work.
However, providing the absolute path works:
execpff("C:\mydata\biz\trading\folder\file.xtb.pff");
What can i do? I need to be able to use a relative path...
Thanks
ExecPFF doesn't understand relative Paths
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
-
- Posts: 1777
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: ExecPFF doesn't understand relative Paths
CSPro doesn't support relative path names in the function calls to execpff or execsystem, but you can convert relative names to absolute names using a user-defined function like this:
alpha (300) temp,temp2;
function alpha (300) relativeToAbsolute(alpha (300) path)
// first figure out how many previous directories are being used
numeric backPaths,startNewPath;
temp = path;
do while pos("..\",temp)
inc(backPaths);
temp2 = temp[pos("..\",temp) + 3];
temp = temp2;
enddo;
temp2 = pathname(application); // this will end with a \
startNewPath = length(strip(temp2)) - 1;
do while backPaths and startNewPath
if temp2[startNewPath:1] = '\' then
inc(backPaths,-1);
endif;
inc(startNewPath,-1);
enddo;
relativeToAbsolute = concat(temp2[1:startNewPath],'\',temp);
end;
function alpha (300) relativeToAbsolute(alpha (300) path)
// first figure out how many previous directories are being used
numeric backPaths,startNewPath;
temp = path;
do while pos("..\",temp)
inc(backPaths);
temp2 = temp[pos("..\",temp) + 3];
temp = temp2;
enddo;
temp2 = pathname(application); // this will end with a \
startNewPath = length(strip(temp2)) - 1;
do while backPaths and startNewPath
if temp2[startNewPath:1] = '\' then
inc(backPaths,-1);
endif;
inc(startNewPath,-1);
enddo;
relativeToAbsolute = concat(temp2[1:startNewPath],'\',temp);
end;
Last bumped by Anonymous on March 23rd, 2012, 8:14 pm.