Friday, 15 February 2013

Conflict between relative and absolute path while using two exe file in delphi -



Conflict between relative and absolute path while using two exe file in delphi -

i have 1 exe myapp.exe in c:\myproject folder. writes logs in logfile tracefile.log there in c:\myproject.

now have create schedule task schedule1.exe write in logfile tracefile.log located in c:\myproject.

ok, created schedule1.exe , kept in same folder c:\myproject folder , made schedule taks using exe.

problem: schedule1.exe cannot pick path of logfile when give relative path of logfile ".\tracefile.log". when give total path "c:\myproject", picks logfile path , writes on it.

please suggest problem?

relative paths relative working directory of process. working directory of process determined @ process startup, , may not directory contains executable. what's more, working directory can alter during processes life.

it seems me should giving total path these files. need hold of directory in executable lives. is

extractfilepath(paramstr(0));

so should using code name file:

extractfilepath(paramstr(0)) + 'tracefile.log'

delphi delphi-xe2 delphi-7

No comments:

Post a Comment