Skip to content

Commit b651390

Browse files
Tidying
1 parent aed3e3e commit b651390

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

Include/runcpp2/runcpp2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace runcpp2
6161
const std::vector<std::string>& runArgs,
6262
const Data::ScriptInfo* lastScriptInfo,
6363
Data::ScriptInfo& outScriptInfo,
64-
const std::string& outputDir,
64+
const std::string& buildOutputDir,
6565
int& returnStatus);
6666
}
6767

Src/runcpp2/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int main(int argc, char* argv[])
260260
ssLOG_BASE(" -s, --[s]how-config-path Show where runcpp2 is reading the config from");
261261
ssLOG_BASE(" -t, --create-script-[t]emplate <file> Creates/prepend runcpp2 script info template");
262262
ssLOG_BASE(" -w, --[w]atch Watch script changes and output any compiling errors");
263-
ssLOG_BASE(" -b, --[b]uild Build the script and copy output files to the script's directory");
263+
ssLOG_BASE(" -b, --[b]uild Build the script and copy output files to the working directory");
264264

265265
return 0;
266266
}

Src/runcpp2/runcpp2.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ runcpp2::StartPipeline( const std::string& scriptPath,
482482
const std::vector<std::string>& runArgs,
483483
const Data::ScriptInfo* lastScriptInfo,
484484
Data::ScriptInfo& outScriptInfo,
485-
const std::string& outputDir,
485+
const std::string& buildOutputDir,
486486
int& returnStatus)
487487
{
488488
INTERNAL_RUNCPP2_SAFE_START();
@@ -977,33 +977,39 @@ runcpp2::StartPipeline( const std::string& scriptPath,
977977
}
978978
else
979979
{
980+
std::error_code e;
981+
980982
// Copy the output file
981-
ghc::filesystem::path destFile = ghc::filesystem::path(outputDir) / target.filename();
982-
std::error_code ec;
983-
ghc::filesystem::copy( target, destFile,
984-
ghc::filesystem::copy_options::overwrite_existing, ec);
985-
if(ec)
986983
{
987-
ssLOG_ERROR("Failed to copy output file: " << ec.message());
988-
return PipelineResult::UNEXPECTED_FAILURE;
984+
ghc::filesystem::path destFile =
985+
ghc::filesystem::path(buildOutputDir) / target.filename();
986+
987+
ghc::filesystem::copy( target, destFile,
988+
ghc::filesystem::copy_options::overwrite_existing, e);
989+
if(e)
990+
{
991+
ssLOG_ERROR("Failed to copy output file: " << e.message());
992+
return PipelineResult::UNEXPECTED_FAILURE;
993+
}
989994
}
990995

991996
// Copy the files that need to be copied
992997
for(int i = 0; i < filesToCopyPaths.size(); ++i)
993998
{
994999
ghc::filesystem::path srcFile(filesToCopyPaths.at(i));
9951000
ghc::filesystem::path destFile =
996-
ghc::filesystem::path(outputDir) / srcFile.filename();
1001+
ghc::filesystem::path(buildOutputDir) / srcFile.filename();
9971002
ghc::filesystem::copy( srcFile, destFile,
998-
ghc::filesystem::copy_options::overwrite_existing, ec);
999-
if(ec)
1003+
ghc::filesystem::copy_options::overwrite_existing, e);
1004+
if(e)
10001005
{
1001-
ssLOG_ERROR("Failed to copy file " << filesToCopyPaths.at(i) << ": " << ec.message());
1006+
ssLOG_ERROR("Failed to copy file " << filesToCopyPaths.at(i) << ": " <<
1007+
e.message());
10021008
return PipelineResult::UNEXPECTED_FAILURE;
10031009
}
10041010
}
10051011

1006-
ssLOG_INFO("Build completed. Files copied to " << outputDir);
1012+
ssLOG_INFO("Build completed. Files copied to " << buildOutputDir);
10071013
return PipelineResult::SUCCESS;
10081014
}
10091015
}

0 commit comments

Comments
 (0)