]> git.tdb.fi Git - builder.git/commitdiff
Deal with absolute paths in tool commands
authorMikko Rasa <tdb@tdb.fi>
Fri, 3 Oct 2014 22:09:27 +0000 (01:09 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 3 Oct 2014 22:09:27 +0000 (01:09 +0300)
source/tool.cpp
source/virtualfilesystem.cpp

index abded33f7aba8131d1f64d8b6c050a3da1e7d504..3aa2db3c713716ba7d90bcafa715afe368a37302 100644 (file)
@@ -28,7 +28,7 @@ void Tool::set_command(const string &cmd, bool cross)
        if(cmd.empty())
                throw invalid_argument("Tool::set_command");
 
-       if(cross && architecture->is_cross())
+       if(cross && architecture->is_cross() && !FS::Path(cmd).is_absolute())
                command = format("%s-%s", architecture->get_cross_prefix(), cmd);
        else
                command = cmd;
index 0e9595085b08d1523fe89d7a714a2809f84f138c..869a1e3899c4c3d4adfd6ff06da83fde142230d9 100644 (file)
@@ -137,7 +137,9 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath
 FileTarget *VirtualFileSystem::find_binary(const string &name)
 {
        SearchPath path;
-       if(const char *env_path = getenv("PATH"))
+       if(FS::Path(name).is_absolute())
+               path.push_back("/");
+       else if(const char *env_path = getenv("PATH"))
        {
                vector<string> parts = split(env_path, ':');
                for(vector<string>::const_iterator i=parts.begin(); i!=parts.end(); ++i)