summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-02 15:05:05 +0200
committerMattes D <github@xoft.cz>2015-06-02 15:05:05 +0200
commita42daecd0b9317c3e70177566757e218ccab2ef6 (patch)
tree50ccb1bb3e5c71830ca76c106ea76253df19ecf0 /src/main.cpp
parentMerge pull request #2189 from mc-server/MSVCWarningFixes (diff)
parentUse the new style command line parameters for Windows Service support. (diff)
downloadcuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar.gz
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar.bz2
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar.lz
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar.xz
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.tar.zst
cuberite-a42daecd0b9317c3e70177566757e218ccab2ef6.zip
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5cd057278..d5c39cecd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -382,6 +382,10 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
TCLAP::SwitchArg noBufArg("", "no-output-buffering", "Disable output buffering", cmd);
+ TCLAP::SwitchArg runAsServiceArg("d", "run-as-service", "Run as a service on Windows", cmd);
+
+ cmd.ignoreUnmatched(true);
+
cmd.parse(argc, argv);
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
@@ -420,6 +424,11 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
setvbuf(stdout, nullptr, _IONBF, 0);
}
+ if (runAsServiceArg.getValue())
+ {
+ cRoot::m_RunAsService = true;
+ }
+
repo->SetReadOnly();
return repo;
@@ -493,16 +502,6 @@ int main(int argc, char **argv)
auto argsRepo = parseArguments(argc, argv);
- // Check if comm logging is to be enabled:
- for (int i = 0; i < argc; i++)
- {
- AString Arg(argv[i]);
- if (NoCaseCompare(Arg, "/service") == 0)
- {
- cRoot::m_RunAsService = true;
- }
- } // for i - argv[]
-
#if defined(_WIN32)
// Attempt to run as a service
if (cRoot::m_RunAsService)