|
|
@@ -19,12 +19,6 @@ const int ConfigPathArgNumber = 1; |
|
|
|
const int MaxArgcNumber = 2;
|
|
|
|
const string DefaultConfigFile = "snf_engine.xml";
|
|
|
|
|
|
|
|
#if defined(WIN32) || defined(WIN64)
|
|
|
|
const string PathSep = "\\";
|
|
|
|
#else
|
|
|
|
const string PathSep = "/";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bool CommandLineIsValid(int argc, char*argv[]) { // Validate the command line.
|
|
|
|
if(argc > MaxArgcNumber) {
|
|
|
|
cout << "* CGPSNF - Bad command line. Use:" << endl
|
|
|
@@ -40,8 +34,8 @@ bool CommandLineIsValid(int argc, char*argv[]) { |
|
|
|
}
|
|
|
|
|
|
|
|
string ConfigPathFromArgv0(const string Argv0) { // Return the config file name in
|
|
|
|
// the same directory as the executable.
|
|
|
|
string::size_type LastSlashIndex = Argv0.find_last_of(PathSep);
|
|
|
|
const string Slashes = "/\\"; // the same directory as the executable.
|
|
|
|
string::size_type LastSlashIndex = Argv0.find_last_of(Slashes);
|
|
|
|
if (string::npos == LastSlashIndex) { // If there's no slash in the path...
|
|
|
|
return DefaultConfigFile;
|
|
|
|
}
|