From e1030dc6e69863438fe35a628bd6af9abc814b4a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 31 Jul 2022 13:31:27 +0200 Subject: Convert absolute source_location paths to relative ones. --- src/rebuild.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 #include #include +#include #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; -- cgit v1.2.3