Parcourir la source

Simplified default configuration file path logic

git-svn-id: https://svn.microneil.com/svn/SNF4CGP/trunk@47 59e8e3e7-56fa-483b-b4b4-fa6ab0af3dfc
master
madscientist il y a 15 ans
Parent
révision
aa7601fc0a
1 fichiers modifiés avec 2 ajouts et 8 suppressions
  1. 2
    8
      SNF4CGP/main.cpp

+ 2
- 8
SNF4CGP/main.cpp Voir le fichier

@@ -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;
}

Chargement…
Annuler
Enregistrer