path - Delphi Get file location -
to determine exe path, don't know code should use. please give me explanation when , why should use:
1. extractfilepath(paramstr(0))
2. extractfilepath(application.exename)
because both code rendering same output.
c:\users\bianca\documents\rad studio\projects\exam1\win32\release\ c:\users\bianca\documents\rad studio\projects\exam1\win32\release\
they both give same result, there subtle differences.
application.exename references vcl application object. utilize of property requires utilize vcl.forms unit. internally phone call paramstr(0) function.
notice firemonkey tapplication class not have property (as of xe5). cannot phone call application.exename if using firemonkey. , if ever migrate vcl project firemonkey have rewrite this.
the paramstr function otoh scheme unit , multiplatform (win, mac, ios , android, depending oc on delphi version using). on windows paramstr(0) calls getmodulefilename function, while on other platforms parses command line returning first token, should total path , name of running executable. (thanks rob kennedy correction)
so... i'd suggest utilize paramstr(0) directly.
delphi path
No comments:
Post a Comment