X-Git-Url: http://git.tdb.fi/?p=builder.git;a=blobdiff_plain;f=source%2Flib%2Fcomponent.cpp;fp=source%2Flib%2Fcomponent.cpp;h=637bc187c8dc26fae0fa45600d7721a8dbe1387b;hp=61aa0db855867ed91863ec1e2d99b336c849f4a6;hb=fa77f807be7a92e655befa2c344128d2dadd788f;hpb=cb7570b1cc8364481550eca1447cd6a140b31aa7 diff --git a/source/lib/component.cpp b/source/lib/component.cpp index 61aa0db..637bc18 100644 --- a/source/lib/component.cpp +++ b/source/lib/component.cpp @@ -65,6 +65,28 @@ void Component::create_build_info() p = (package.get_source_directory()/p).str(); } +FS::Path Component::get_temp_directory() const +{ + return package.get_temp_directory()/name; +} + +string Component::flatten_source_path(const FS::Path &source) const +{ + FS::Path temp_dir = get_temp_directory(); + FS::Path rel_src; + if(FS::descendant_depth(source, temp_dir)>=0) + rel_src = FS::relative(source, temp_dir); + else + rel_src = FS::relative(source, package.get_source_directory()); + + string fn; + for(const string &c: rel_src) + if(c!=".") + append(fn, "_", c); + + return fn; +} + BuildInfo Component::get_build_info_for_path(const FS::Path &path) const { // XXX Cache these and check that the directories actually exist before adding them