From cd36f59cac72920d1b46036da3ddcc82f7280c96 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 27 Aug 2021 20:44:10 +0200 Subject: Fix path to string conversions. --- task_ar.cc | 14 +++++++------- task_cc.cc | 20 ++++++++++---------- task_ld.cc | 16 ++++++++-------- task_so.cc | 16 ++++++++-------- tasks.cc | 2 +- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/task_ar.cc b/task_ar.cc index bcaa010..5568629 100644 --- a/task_ar.cc +++ b/task_ar.cc @@ -51,7 +51,7 @@ TaskAR::TaskAR(const BuildConfiguration& config, { std::filesystem::path objectFile = object; objectFiles.push_back(objectFile); - dependsStr.push_back(objectFile); + dependsStr.push_back(objectFile.string()); } for(const auto& dep : config.depends) @@ -98,7 +98,7 @@ bool TaskAR::dirtyInner() } { - auto lastFlags = readFile(flagsFile); + auto lastFlags = readFile(flagsFile.string()); if(flagsString() != lastFlags) { //std::cout << "The compiler flags changed\n"; @@ -118,15 +118,15 @@ int TaskAR::runInner() { objectlist += " "; } - objectlist += std::string(objectFile); + objectlist += objectFile.string(); } std::vector args; args.push_back("rcs"); - args.push_back(std::string(targetFile)); + args.push_back(targetFile.string()); for(const auto& objectFile : objectFiles) { - args.push_back(std::string(objectFile)); + args.push_back(objectFile.string()); } for(const auto& flag : config.ldflags) { @@ -161,13 +161,13 @@ int TaskAR::clean() { if(std::filesystem::exists(targetFile)) { - std::cout << "Removing " << std::string(targetFile) << "\n"; + std::cout << "Removing " << targetFile.string() << "\n"; std::filesystem::remove(targetFile); } if(std::filesystem::exists(flagsFile)) { - std::cout << "Removing " << std::string(flagsFile) << "\n"; + std::cout << "Removing " << flagsFile.string() << "\n"; std::filesystem::remove(flagsFile); } diff --git a/task_cc.cc b/task_cc.cc index 366cbfe..af9cf7a 100644 --- a/task_cc.cc +++ b/task_cc.cc @@ -164,7 +164,7 @@ bool TaskCC::dirtyInner() } { - auto lastFlags = readFile(flagsFile); + auto lastFlags = readFile(flagsFile.string()); if(flagsString() != lastFlags) { //std::cout << "The compiler flags changed\n"; @@ -172,7 +172,7 @@ bool TaskCC::dirtyInner() } } - auto depList = readDeps(depsFile); + auto depList = readDeps(depsFile.string()); for(const auto& dep : depList) { if(!std::filesystem::exists(dep) || @@ -198,14 +198,14 @@ int TaskCC::runInner() { if(!std::filesystem::exists(sourceFile)) { - std::cout << "Missing source file: " << std::string(sourceFile) << "\n"; + std::cout << "Missing source file: " << sourceFile.string() << "\n"; return 1; } auto args = getCompilerArgs(); { // Write flags to file. - std::ofstream flagsStream(flagsFile); + std::ofstream flagsStream(flagsFile.string()); flagsStream << flagsString(); } @@ -223,19 +223,19 @@ int TaskCC::clean() { if(std::filesystem::exists(targetFile)) { - std::cout << "Removing " << std::string(targetFile) << "\n"; + std::cout << "Removing " << targetFile.string() << "\n"; std::filesystem::remove(targetFile); } if(std::filesystem::exists(depsFile)) { - std::cout << "Removing " << std::string(depsFile) << "\n"; + std::cout << "Removing " << depsFile.string() << "\n"; std::filesystem::remove(depsFile); } if(std::filesystem::exists(flagsFile)) { - std::cout << "Removing " << std::string(flagsFile) << "\n"; + std::cout << "Removing " << flagsFile.string() << "\n"; std::filesystem::remove(flagsFile); } @@ -249,7 +249,7 @@ std::vector TaskCC::depends() const std::string TaskCC::target() const { - return targetFile; + return targetFile.string(); } std::string TaskCC::toJSON() const @@ -309,9 +309,9 @@ std::vector TaskCC::getCompilerArgs() const } args.push_back("-c"); - args.push_back(std::string(sourceFile)); + args.push_back(sourceFile.string()); args.push_back("-o"); - args.push_back(std::string(targetFile)); + args.push_back(targetFile.string()); for(const auto& flag : compiler_flags) { diff --git a/task_ld.cc b/task_ld.cc index cd1dea3..91f3316 100644 --- a/task_ld.cc +++ b/task_ld.cc @@ -52,7 +52,7 @@ TaskLD::TaskLD(const BuildConfiguration& config, { std::filesystem::path objectFile = object; objectFiles.push_back(objectFile); - dependsStr.push_back(objectFile); + dependsStr.push_back(objectFile.string()); } for(const auto& dep : config.depends) @@ -99,7 +99,7 @@ bool TaskLD::dirtyInner() } { - auto lastFlags = readFile(flagsFile); + auto lastFlags = readFile(flagsFile.string()); if(flagsString() != lastFlags) { //std::cout << "The compiler flags changed\n"; @@ -119,13 +119,13 @@ int TaskLD::runInner() { objectlist += " "; } - objectlist += std::string(objectFile); + objectlist += objectFile.string(); } std::vector args; for(const auto& objectFile : objectFiles) { - args.push_back(std::string(objectFile)); + args.push_back(objectFile.string()); } for(const auto& depFile : depFiles) @@ -147,7 +147,7 @@ int TaskLD::runInner() args.push_back(flag); } args.push_back("-o"); - args.push_back(std::string(targetFile)); + args.push_back(targetFile.string()); { // Write flags to file. std::ofstream flagsStream(flagsFile); @@ -167,13 +167,13 @@ int TaskLD::clean() { if(std::filesystem::exists(targetFile)) { - std::cout << "Removing " << std::string(targetFile) << "\n"; + std::cout << "Removing " << targetFile.string() << "\n"; std::filesystem::remove(targetFile); } if(std::filesystem::exists(flagsFile)) { - std::cout << "Removing " << std::string(flagsFile) << "\n"; + std::cout << "Removing " << flagsFile.string() << "\n"; std::filesystem::remove(flagsFile); } @@ -198,7 +198,7 @@ std::vector TaskLD::depends() const std::string TaskLD::target() const { - return std::string(targetFile); + return targetFile.string(); } std::string TaskLD::flagsString() const diff --git a/task_so.cc b/task_so.cc index a60e4c3..eaf6a85 100644 --- a/task_so.cc +++ b/task_so.cc @@ -50,7 +50,7 @@ TaskSO::TaskSO(const BuildConfiguration& config, { std::filesystem::path objectFile = object; objectFiles.push_back(objectFile); - dependsStr.push_back(objectFile); + dependsStr.push_back(objectFile.string()); } for(const auto& dep : config.depends) @@ -97,7 +97,7 @@ bool TaskSO::dirtyInner() } { - auto lastFlags = readFile(flagsFile); + auto lastFlags = readFile(flagsFile.string()); if(flagsString() != lastFlags) { //std::cout << "The compiler flags changed\n"; @@ -117,7 +117,7 @@ int TaskSO::runInner() { objectlist += " "; } - objectlist += std::string(objectFile); + objectlist += objectFile.string(); } std::vector args; @@ -126,11 +126,11 @@ int TaskSO::runInner() args.push_back("-shared"); args.push_back("-o"); - args.push_back(std::string(targetFile)); + args.push_back(targetFile.string()); for(const auto& objectFile : objectFiles) { - args.push_back(std::string(objectFile)); + args.push_back(objectFile.string()); } for(const auto& depFile : depFiles) @@ -161,13 +161,13 @@ int TaskSO::clean() { if(std::filesystem::exists(targetFile)) { - std::cout << "Removing " << std::string(targetFile) << "\n"; + std::cout << "Removing " << targetFile.string() << "\n"; std::filesystem::remove(targetFile); } if(std::filesystem::exists(flagsFile)) { - std::cout << "Removing " << std::string(flagsFile) << "\n"; + std::cout << "Removing " << flagsFile.string() << "\n"; std::filesystem::remove(flagsFile); } @@ -192,7 +192,7 @@ std::vector TaskSO::depends() const std::string TaskSO::target() const { - return std::string(targetFile); + return targetFile.string(); } std::string TaskSO::flagsString() const diff --git a/tasks.cc b/tasks.cc index ba2c851..93e5a8b 100644 --- a/tasks.cc +++ b/tasks.cc @@ -110,7 +110,7 @@ std::list> getTasks(const Settings& settings) for(std::size_t i = 0; i < numConfigFiles; ++i) { std::string path = - std::filesystem::path(configFiles[i].file).parent_path(); + std::filesystem::path(configFiles[i].file).parent_path().string(); if(settings.verbose > 1) { std::cout << configFiles[i].file << " in path " << path << "\n"; -- cgit v1.2.3