Change get_bin_dir logic to assume exe in cwd if not otherwise found
authorMikko Rasa <tdb@tdb.fi>
Mon, 6 Jan 2014 19:55:30 +0000 (21:55 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 6 Jan 2014 19:55:30 +0000 (21:55 +0200)
Windows has an implicit . component in $PATH, which can cause programs
started from command line to not find their executable in $PATH.  This
fixes the issue, and should not cause undue trouble on other systems.

source/fs/dir.cpp

index 0b6873277d4feb014d76df62afdde602d0679698..c0583cc5ca6fd9011065ed24d89e2d788e2cdcd8 100644 (file)
@@ -47,7 +47,8 @@ const Path &get_bin_dir(const string &argv0)
                                        break;
                                }
                }
-               else
+
+               if(exe.empty())
                        exe = realpath(argv0);
 
                last_argv0 = argv0;