aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-10 22:26:35 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-10 22:26:35 +0100
commit1068b3daeb95322461e69a2d8f0203309bd22830 (patch)
treea6b10bfb1bb656e067cdf3e407a0110f3f755144
parent0a9a44ce15bb772b3193fbee481768e7327db1a9 (diff)
downloadNorthstarLauncher-1068b3daeb95322461e69a2d8f0203309bd22830.tar.gz
NorthstarLauncher-1068b3daeb95322461e69a2d8f0203309bd22830.zip
add nsprefix because i forgot to include it
-rw-r--r--NorthstarDLL/nsprefix.cpp38
-rw-r--r--NorthstarDLL/nsprefix.h7
2 files changed, 45 insertions, 0 deletions
diff --git a/NorthstarDLL/nsprefix.cpp b/NorthstarDLL/nsprefix.cpp
new file mode 100644
index 00000000..26f48861
--- /dev/null
+++ b/NorthstarDLL/nsprefix.cpp
@@ -0,0 +1,38 @@
+#include "pch.h"
+#include "nsprefix.h"
+#include <string>
+
+std::string GetNorthstarPrefix()
+{
+ return NORTHSTAR_FOLDER_PREFIX;
+}
+
+void InitialiseNorthstarPrefix()
+{
+ 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";
+ }
+}
diff --git a/NorthstarDLL/nsprefix.h b/NorthstarDLL/nsprefix.h
new file mode 100644
index 00000000..c0f8c642
--- /dev/null
+++ b/NorthstarDLL/nsprefix.h
@@ -0,0 +1,7 @@
+#pragma once
+#include <string>
+
+static std::string NORTHSTAR_FOLDER_PREFIX;
+
+void InitialiseNorthstarPrefix();
+std::string GetNorthstarPrefix();