From: Mikko Rasa Date: Fri, 3 Oct 2014 22:09:27 +0000 (+0300) Subject: Deal with absolute paths in tool commands X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6c2db179b5d94ddc32ba1a9b631d59d056e594fc;hp=1c80c1c33af10e8e325808906a95969ee57676b6;p=builder.git Deal with absolute paths in tool commands --- diff --git a/source/tool.cpp b/source/tool.cpp index abded33..3aa2db3 100644 --- a/source/tool.cpp +++ b/source/tool.cpp @@ -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; diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index 0e95950..869a1e3 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -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 parts = split(env_path, ':'); for(vector::const_iterator i=parts.begin(); i!=parts.end(); ++i)