From 533df6ba2bca134601acf3541b5c2298f9474de4 Mon Sep 17 00:00:00 2001 From: driAn Date: Tue, 16 Oct 2007 21:30:10 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1370 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/wizard/src/wizard.cpp | 38 ++++++++++++++++++-------------- source/wizard/vcpp/wizard.vcproj | 4 ++-- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/source/wizard/src/wizard.cpp b/source/wizard/src/wizard.cpp index d0ce42e0..add706ad 100644 --- a/source/wizard/src/wizard.cpp +++ b/source/wizard/src/wizard.cpp @@ -1,24 +1,36 @@ -// acserverwizard.cpp : Defines the entry point for the console application. -// +// wizard to start an AssaultCube server and storing the configuration #include -#include #include #include #include #include -#include + using namespace std; #ifdef WIN32 #pragma warning( disable : 4996 ) #include + #include + #include #include "winserviceinstaller.h" +#elif __GNUC__ + #include + #include #endif -int _tmain(int argc, _TCHAR* argv[]) +int main(int argc, char **argv) { + if(argc < 3) + { + cout << "usage: server_wizard "; + return EXIT_FAILURE; + } + + string outfile(argv[1]); + string relpath(argv[2]); + map args; cout << "AssaultCube Server Wizard" << endl << endl; @@ -69,12 +81,6 @@ int _tmain(int argc, _TCHAR* argv[]) getline(cin, wsdisplayname); } - string relpath = "bin_win32\\ac_server.exe"; - -#elif UNIX - - string relpath = "bin_unix/ac_server"; - #endif string argstr; @@ -90,18 +96,19 @@ int _tmain(int argc, _TCHAR* argv[]) } } - cout << endl << "Writing your configuration to ac_server.bat ... "; + cout << endl << "Writing your configuration to " << outfile << " ... "; try { - fstream startupScript("ac_server.bat", ios::out); - startupScript << relpath << argstr << endl << "pause" << endl; + fstream startupScript(outfile.c_str(), ios::out); + #ifdef WIN32 + startupScript << relpath << argstr << endl << "pause" << endl; + #endif startupScript.close(); } catch(...) { cout << "Failed!" << endl; - cin.get(); return EXIT_FAILURE; } @@ -157,7 +164,6 @@ int _tmain(int argc, _TCHAR* argv[]) cin.get(); cout << "Starting the AC server ..." << endl; system((relpath + argstr).c_str()); - cin.get(); return EXIT_SUCCESS; } diff --git a/source/wizard/vcpp/wizard.vcproj b/source/wizard/vcpp/wizard.vcproj index f85c4508..78dd2a33 100644 --- a/source/wizard/vcpp/wizard.vcproj +++ b/source/wizard/vcpp/wizard.vcproj @@ -60,7 +60,7 @@ />