diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-06-07 18:06:57 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-06-09 22:20:31 +0200 |
commit | dafd592cf44c184f9d24e2216bbed5c23e4b23c2 (patch) | |
tree | e94ab4c49ec4486e3a8e91c04cbba73a221d54c7 /src/util.cc | |
parent | 80db51ae3f7d5fbfb52eee4505f615ea4edba62d (diff) |
Refactor the way task names are looked up.
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 9bf83cc..92560b6 100644 --- a/src/util.cc +++ b/src/util.cc @@ -110,3 +110,28 @@ Language languageFromExtension(const std::filesystem::path& file) exit(1); return {}; } + +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; +} |