]> git.tdb.fi Git - builder.git/blobdiff - source/lib/objectfile.cpp
Move some path and filename manipulations into the Component class
[builder.git] / source / lib / objectfile.cpp
index 65ad4330cb740b6ecc57e7f9fd4f8b3783e93399..63a8e6b2b7c44a61c6699b71eb7f5d94e5ac2862 100644 (file)
@@ -19,23 +19,9 @@ ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s):
 
 FS::Path ObjectFile::generate_target_path(const Component &comp, const FS::Path &src)
 {
-       const SourcePackage &pkg = comp.get_package();
-       FS::Path temp_dir = pkg.get_temp_directory();
-       FS::Path rel_src;
-       if(FS::descendant_depth(src, temp_dir)>=0)
-               rel_src = FS::relative(src, temp_dir);
-       else
-               rel_src = FS::relative(src, pkg.get_source_directory());
-       string fn;
-       for(const string &c: rel_src)
-       {
-               if(!fn.empty())
-                       fn += '_';
-               if(c!=".")
-                       fn += c;
-       }
+       string fn = comp.flatten_source_path(src);
        const Architecture &arch = comp.get_package().get_builder().get_current_arch();
-       return temp_dir/comp.get_name()/arch.create_filename<ObjectFile>(FS::basepart(fn));
+       return comp.get_temp_directory()/arch.create_filename<ObjectFile>(FS::basepart(fn));
 }
 
 void ObjectFile::set_used_in_shared_library(bool u)