aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/nsprefix.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-08-25 00:27:26 +0100
committerGitHub <noreply@github.com>2022-08-25 01:27:26 +0200
commitf8885bc12e0f9c295a174319314e37cae310b192 (patch)
tree9e1be099d4544a5d9ab77a3cfcdf1a1732ee25a0 /NorthstarDLL/nsprefix.cpp
parentc3d20c8409a35772e371129d015913b7f08743fc (diff)
downloadNorthstarLauncher-f8885bc12e0f9c295a174319314e37cae310b192.tar.gz
NorthstarLauncher-f8885bc12e0f9c295a174319314e37cae310b192.zip
Rename `configurables.cpp` to `nsprefix.cpp` (#253)
Diffstat (limited to 'NorthstarDLL/nsprefix.cpp')
-rw-r--r--NorthstarDLL/nsprefix.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/NorthstarDLL/nsprefix.cpp b/NorthstarDLL/nsprefix.cpp
new file mode 100644
index 00000000..4c165e05
--- /dev/null
+++ b/NorthstarDLL/nsprefix.cpp
@@ -0,0 +1,38 @@
+#include <string>
+#include "pch.h"
+#include "nsprefix.h"
+
+std::string GetNorthstarPrefix()
+{
+ return NORTHSTAR_FOLDER_PREFIX;
+}
+
+void parseConfigurables()
+{
+ char* clachar = strstr(GetCommandLineA(), "-profile=");
+ if (clachar)
+ {
+ std::string cla = std::string(clachar);
+ if (strncmp(cla.substr(9, 1).c_str(), "\"", 1))
+ {
+ 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("Profile was not found in command line arguments. Using default: R2Northstar");
+ NORTHSTAR_FOLDER_PREFIX = "R2Northstar";
+ }
+}