{
Path exe;
if(argv0.find(DIRSEP)==string::npos)
- {
- const char *path = getenv("PATH");
- vector<string> dirs = split(path, ITEMSEP);
- for(vector<string>::const_iterator i=dirs.begin(); i!=dirs.end(); ++i)
- if(exists(Path(*i)/argv0))
- {
- exe = realpath(Path(*i)/argv0);
- break;
- }
- }
+ if(const char *path = getenv("PATH"))
+ {
+ vector<string> dirs = split(path, ITEMSEP);
+ for(vector<string>::const_iterator i=dirs.begin(); i!=dirs.end(); ++i)
+ if(exists(Path(*i)/argv0))
+ {
+ exe = realpath(Path(*i)/argv0);
+ break;
+ }
+ }
if(exe.empty())
exe = realpath(argv0);