Skip to content

Commit aed3e3e

Browse files
Perform local build in working directory instead
1 parent e1f20fd commit aed3e3e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ or `Header`
8686
- `Setup`, `Build` and `Cleanup`: List of shell commands for one time setup, building and
8787
cleaning up
8888

89-
To access the source files of the dependencies, you can specify runcpp2 to build locally at
90-
where it script is by passing the `--local` flag. This is useful when you want to
89+
To access the source files of the dependencies, you can specify runcpp2 to build locally in
90+
the current working directory by passing the `--local` flag. This is useful when you want to
9191
look at the headers of the dependencies.
9292

9393
```shell
9494
runcpp2 --local ./script.cpp
9595
```
9696

97-
This will create a `.runcpp2` folder and all the builds and dependencies will be inside it.
97+
This will create a `.runcpp2` folder in the current working directory, and all the builds and dependencies will be inside it.

Src/runcpp2/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ int main(int argc, char* argv[])
256256
ssLOG_BASE(" -e, --[e]xecutable Runs as executable instead of shared library");
257257
ssLOG_BASE(" -h, --[h]elp Show this help message");
258258
ssLOG_BASE(" -d, --remove-[d]ependencies Remove dependencies listed in the script");
259-
ssLOG_BASE(" -l, --[l]ocal Build the script and dependencies locally");
259+
ssLOG_BASE(" -l, --[l]ocal Build in the current working directory under .runcpp2 directory");
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");

Src/runcpp2/runcpp2.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ namespace
2323
bool CreateLocalBuildDirectory( const std::string& scriptPath,
2424
ghc::filesystem::path& outBuildPath)
2525
{
26-
std::string scriptDirectory = ghc::filesystem::path(scriptPath).parent_path().string();
26+
// Get the current working directory
27+
std::string currentWorkingDir = ghc::filesystem::current_path().string();
2728

28-
//Create the runcpp2 directory
29-
std::string runcpp2Dir = scriptDirectory + "/.runcpp2";
29+
// Create the .runcpp2 directory in the current working directory
30+
std::string runcpp2Dir = currentWorkingDir + "/.runcpp2";
3031

3132
std::error_code e;
3233
if(!ghc::filesystem::exists(runcpp2Dir, e))
3334
{
3435
if(!ghc::filesystem::create_directory(runcpp2Dir, e))
3536
{
36-
ssLOG_ERROR("Failed to create runcpp2 directory");
37+
ssLOG_ERROR("Failed to create .runcpp2 directory in the current working directory");
3738
return false;
3839
}
3940
}
@@ -613,9 +614,8 @@ runcpp2::StartPipeline( const std::string& scriptPath,
613614

614615
//Create build directory
615616
{
616-
const bool localBuildDir = currentOptions.count(CmdOptions::LOCAL) > 0;
617617
bool createdBuildDir = false;
618-
if(localBuildDir)
618+
if(currentOptions.count(CmdOptions::LOCAL) > 0)
619619
{
620620
if(CreateLocalBuildDirectory(absoluteScriptPath, buildDir))
621621
createdBuildDir = true;

0 commit comments

Comments
 (0)