]> git.tdb.fi Git - builder.git/blobdiff - source/filetarget.cpp
Put constructor helper functions next to the constructors
[builder.git] / source / filetarget.cpp
index 1c61810498937199f3ba35c6d5374febff18d151..634b297b996070e45ed9a98ee736c6e9f4826718 100644 (file)
@@ -25,6 +25,25 @@ FileTarget::FileTarget(Builder &b, const SourcePackage *p, const FS::Path &a):
        }
 }
 
+string FileTarget::generate_name(const SourcePackage *pkg, const FS::Path &pth)
+{
+       if(pkg)
+       {
+               if(FS::descendant_depth(pth, pkg->get_source())>=0)
+               {
+                       FS::Path relpath = FS::relative(pth, pkg->get_source());
+                       return format("<%s>%s", pkg->get_name(), relpath.str().substr(1));
+               }
+               else if(FS::descendant_depth(pth, pkg->get_builder().get_prefix())>=0)
+               {
+                       FS::Path relpath = FS::relative(pth, pkg->get_builder().get_prefix());
+                       return "<prefix>"+relpath.str().substr(1);
+               }
+       }
+
+       return pth.str();
+}
+
 void FileTarget::touch()
 {
        mtime = Time::now();
@@ -53,22 +72,3 @@ void FileTarget::check_rebuild()
        if(!needs_rebuild() && package && package->get_config().get_mtime()>mtime)
                mark_rebuild("Package options changed");
 }
-
-string FileTarget::generate_name(const SourcePackage *pkg, const FS::Path &pth)
-{
-       if(pkg)
-       {
-               if(FS::descendant_depth(pth, pkg->get_source())>=0)
-               {
-                       FS::Path relpath = FS::relative(pth, pkg->get_source());
-                       return format("<%s>%s", pkg->get_name(), relpath.str().substr(1));
-               }
-               else if(FS::descendant_depth(pth, pkg->get_builder().get_prefix())>=0)
-               {
-                       FS::Path relpath = FS::relative(pth, pkg->get_builder().get_prefix());
-                       return "<prefix>"+relpath.str().substr(1);
-               }
-       }
-
-       return pth.str();
-}