summaryrefslogtreecommitdiff
path: root/src/task_cc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task_cc.cc')
-rw-r--r--src/task_cc.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/task_cc.cc b/src/task_cc.cc
index 73297f2..e4bd7aa 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -12,6 +12,31 @@
#include "execute.h"
#include "util.h"
+namespace
+{
+bool isClean(char c)
+{
+ return c != '.' && c != '/';
+}
+
+std::string cleanUp(const std::string& path)
+{
+ std::string cleaned;
+ for(const auto& c : path)
+ {
+ if(isClean(c))
+ {
+ cleaned += c;
+ }
+ else
+ {
+ cleaned += '_';
+ }
+ }
+ return cleaned;
+}
+}
+
TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
const std::string& sourceDir, const Source& source)
: Task(config)
@@ -26,7 +51,7 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
base /= sourceFile.parent_path();
std::filesystem::create_directories(base);
- base /= config.target;
+ base /= cleanUp(config.target);
base += "-";
base += sourceFile.stem();