diff options
Diffstat (limited to 'src/rebuild.cc')
-rw-r--r-- | src/rebuild.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc index a82e0cc..9ddf5ba 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -7,6 +7,7 @@ #include <filesystem> #include <algorithm> #include <source_location> +#include <cstring> #include "configure.h" #include "libctor.h" @@ -30,7 +31,17 @@ int reg(BuildConfigurations (*cb)(const Settings&), exit(1); } - configFiles[numConfigFiles].file = location.file_name(); + auto loc = std::filesystem::path(location.file_name()); + if(loc.is_absolute()) + { + auto pwd = std::filesystem::current_path(); + auto rel = std::filesystem::relative(loc, pwd); + configFiles[numConfigFiles].file = strdup(rel.string().data()); // NOTE: This intentionally leaks memory + } + else + { + configFiles[numConfigFiles].file = location.file_name(); + } configFiles[numConfigFiles].cb = cb; ++numConfigFiles; |