aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/configurables.cpp
diff options
context:
space:
mode:
authorEmma Miler <27428383+emma-miler@users.noreply.github.com>2022-01-30 20:32:33 +0100
committerEmma Miler <27428383+emma-miler@users.noreply.github.com>2022-01-30 20:32:33 +0100
commit7e338fac5c15a3cd6efdd570a93e6d8586856143 (patch)
tree910dae9926776e39462153f7a135dbd9c9eef7a8 /NorthstarDedicatedTest/configurables.cpp
parenta589bb0082cbae6d326644292179c9427e76e795 (diff)
downloadNorthstarLauncher-7e338fac5c15a3cd6efdd570a93e6d8586856143.tar.gz
NorthstarLauncher-7e338fac5c15a3cd6efdd570a93e6d8586856143.zip
Added command line option for custom northstar dir
Added command line option for custom northstar dir https://github.com/orgs/R2Northstar/projects/1#card-76312632
Diffstat (limited to 'NorthstarDedicatedTest/configurables.cpp')
-rw-r--r--NorthstarDedicatedTest/configurables.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/configurables.cpp b/NorthstarDedicatedTest/configurables.cpp
new file mode 100644
index 00000000..1ed345ef
--- /dev/null
+++ b/NorthstarDedicatedTest/configurables.cpp
@@ -0,0 +1,32 @@
+#include <string>
+#include "pch.h"
+#include "configurables.h"
+
+std::string GetNorthstarPrefix() {
+ return NORTHSTAR_FOLDER_PREFIX;
+}
+
+void parseConfigurables() {
+ char* clachar = strstr(GetCommandLineA(), "-profile=");
+ if (clachar) {
+ std::string cla = std::string(clachar);
+ if (strcmp(cla.substr(9, 1).c_str(), "\"")) {
+ int space = cla.find(" ");
+ std::string dirname = cla.substr(9, space - 9);
+ spdlog::info("Found profile in command line arguments: " + dirname);
+ NORTHSTAR_FOLDER_PREFIX = dirname;
+ }
+ else {
+ std::string quote = "\"";
+ int quote1 = cla.find(quote);
+ int quote2 = (cla.substr(quote1 + 1)).find(quote);
+ std::string dirname = cla.substr(quote1 + 1, quote2);
+ spdlog::info("Found profile in command line arguments: " + dirname);
+ NORTHSTAR_FOLDER_PREFIX = dirname;
+ }
+ }
+ else {
+ spdlog::info("Didnt' find profile in command line arguments. Using default: R2Northstar");
+ NORTHSTAR_FOLDER_PREFIX = "R2Northstar";
+ }
+} \ No newline at end of file