X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvirtualfilesystem.cpp;h=2fecdf0fc50c9427fd1d06c194b597b7b41ff864;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=935600de085f6409a157a0303e68b7f39c168da1;hpb=7c2db9e2b91da953701be233336c5bfa1f3c4af0;p=builder.git diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index 935600d..2fecdf0 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -22,7 +22,7 @@ VirtualFileSystem::VirtualFileSystem(Builder &b): FileTarget *VirtualFileSystem::get_target(const FS::Path &p) const { - TargetMap::const_iterator i = targets.find(p.str()); + auto i = targets.find(p.str()); if(i!=targets.end()) return static_cast(i->second); return 0; @@ -30,7 +30,7 @@ FileTarget *VirtualFileSystem::get_target(const FS::Path &p) const void VirtualFileSystem::register_path(const FS::Path &path, FileTarget *t) { - targets.insert(TargetMap::value_type(path.str(), t)); + targets.insert({ path, t }); nonexistent.erase(path); builder.get_logger().log("vfs", format("Path %s registered to %s", path, t->get_name())); } @@ -44,10 +44,10 @@ FileTarget *VirtualFileSystem::find_header(const string &name, Tool *tool, const tool->prepare(); - list combined_path(path.begin(), path.end()); + SearchPath combined_path = path; if(use_syspath) { - const Tool::SearchPath &syspath = tool->get_system_path(); + const SearchPath &syspath = tool->get_system_path(); combined_path.insert(combined_path.end(), syspath.begin(), syspath.end()); } @@ -73,18 +73,18 @@ FileTarget *VirtualFileSystem::find_header(const string &name, Tool *tool, const FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath &path, BuildInfo::LibraryMode mode, bool use_syspath) { - list combined_path(path.begin(), path.end()); + SearchPath combined_path = path; if(use_syspath) { Tool &linker = builder.get_toolchain().get_tool("LINK"); linker.prepare(); - const Tool::SearchPath &syspath = linker.get_system_path(); + const SearchPath &syspath = linker.get_system_path(); combined_path.insert(combined_path.end(), syspath.begin(), syspath.end()); } const Architecture &arch = builder.get_current_arch(); - list shared_names; + vector shared_names; bool use_import_lib = false; if(mode!=BuildInfo::FORCE_STATIC) { @@ -93,13 +93,13 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath shared_names = Pattern::apply_list(arch.get_patterns(), lib); } - list static_names; + vector static_names; if(mode!=BuildInfo::FORCE_DYNAMIC) static_names = Pattern::apply_list(arch.get_patterns(), lib); for(const FS::Path &p: combined_path) { - const list *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names); + const vector *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names); for(auto j=cur_names->begin(); j!=cur_names->end(); ) { FS::Path filename = p / *j; @@ -146,17 +146,21 @@ FileTarget *VirtualFileSystem::find_binary(const string &name) path.push_back("/"); else { - string env_path = Msp::getenv("PATH"); - if(!env_path.empty()) + if(sys_bin_path.empty()) { - for(const string &p: split(env_path, ':')) - path.push_back(p); - } - else - { - path.push_back("/bin"); - path.push_back("/usr/bin"); + string env_path = Msp::getenv("PATH"); + if(!env_path.empty()) + { + for(const string &p: split(env_path, ':')) + sys_bin_path.push_back(p); + } + else + { + sys_bin_path.push_back("/bin"); + sys_bin_path.push_back("/usr/bin"); + } } + path = sys_bin_path; } for(const FS::Path &p: path)