summaryrefslogtreecommitdiff
path: root/rebuild.cc
diff options
context:
space:
mode:
Diffstat (limited to 'rebuild.cc')
-rw-r--r--rebuild.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/rebuild.cc b/rebuild.cc
index b4564de..43c4c98 100644
--- a/rebuild.cc
+++ b/rebuild.cc
@@ -54,7 +54,8 @@ int unreg(const char* location)
return found;
}
-void recompileCheck(const Settings& settings, int argc, char* argv[], bool force)
+void recompileCheck(const Settings& settings, int argc, char* argv[],
+ bool force, bool relaunch_allowed)
{
bool dirty{force};
@@ -64,7 +65,7 @@ void recompileCheck(const Settings& settings, int argc, char* argv[], bool force
args.push_back("-std=c++17");
args.push_back("-pthread");
- std::filesystem::path binFile("cppbuild");
+ std::filesystem::path binFile(argv[0]);
if(std::filesystem::exists(configurationFile))
{
@@ -125,13 +126,16 @@ void recompileCheck(const Settings& settings, int argc, char* argv[], bool force
}
else
{
- std::cout << "Re-launch\n";
- std::vector<std::string> args;
- for(int i = 1; i < argc; ++i)
+ if(relaunch_allowed)
{
- args.push_back(argv[i]);
+ std::cout << "Re-launch\n";
+ std::vector<std::string> args;
+ for(int i = 1; i < argc; ++i)
+ {
+ args.push_back(argv[i]);
+ }
+ exit(execute(argv[0], args, settings.verbose > 0));
}
- exit(execute(argv[0], args, settings.verbose > 0));
}
}
}