From 463a3521e27870294455373f9c69279069611975 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 31 Mar 2012 13:47:28 +0300 Subject: [PATCH] Improve file target naming --- source/filetarget.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/filetarget.cpp b/source/filetarget.cpp index 8867231..1deead0 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -64,9 +64,17 @@ string FileTarget::make_name(const Package *pkg, const FS::Path &pth) { if(const SourcePackage *spkg = dynamic_cast(pkg)) { - FS::Path relpath = FS::relative(pth, spkg->get_source()); - return format("<%s>%s", pkg->get_name(), relpath.str().substr(1)); + if(FS::descendant_depth(pth, spkg->get_source())>=0) + { + FS::Path relpath = FS::relative(pth, spkg->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 ""+relpath.str().substr(1); + } } - else - return pth.str(); + + return pth.str(); } -- 2.43.0