CString CFilenames::IniFilePath() { // We need the complete path here, // otherwise the file would be expected in the default location, // i.e. the Windows-directory. return OpenHoldemDirectory() + CString("\\") + IniFilename(); }
CString CFilenames::IniFilename() { WIN32_FIND_DATA find_file_data; HANDLE h_find; CString wildcard = OpenHoldemDirectory() + "\\*.INI"; CString ini_filename; // Try to find "first" ini-file. // No matter how it is named -- it is the right one. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx h_find = FindFirstFile(wildcard, &find_file_data); if (h_find == INVALID_HANDLE_VALUE) { // No ini-file found. // Use default one (for saving). FindClose(h_find); Log("IniFilename", k_default_ini_filename); return k_default_ini_filename; } ini_filename = find_file_data.cFileName; // Check that no more ini-files exist (potential problems). // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx if (FindNextFile(h_find, &find_file_data)) { FindClose(h_find); OH_MessageBox_Error_Warning( "More than one ini-file in OpenHoldem-directory.\n" "Don't know which one to use.\n" "\n" "Going to terminate..."); PostQuitMessage(-1); // Previously we returned "a_result_to_make_the_compiler_happy.ini" // believing the result was meaning-less and would never be used. // However PostQuitMessage(-1) uses a message-queue, // so it may take some time, and OH will continue a little bit. // Therefore we take the last filename now in order to // not create yet another one with a funny name. ;-) // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=16229 Log("IniFilename", ini_filename.GetString()); return ini_filename; } FindClose(h_find); // Exactly one ini-file found Log("IniFilename", ini_filename.GetString()); return ini_filename; }
CString CFilenames::IniFilename() { WIN32_FIND_DATA find_file_data; HANDLE h_find; CString wildcard = OpenHoldemDirectory() + "\\*.INI"; CString ini_filename; // Try to find "first" ini-file. // No matter how it is named -- it is the right one. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx h_find = FindFirstFile(wildcard, &find_file_data); if (h_find == INVALID_HANDLE_VALUE) { // No ini-file found. // Use default one (for saving). FindClose(h_find); return k_default_ini_filename; } ini_filename = find_file_data.cFileName; // Check that no more ini-files exist (potential problems). // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx if (FindNextFile(h_find, &find_file_data)) { FindClose(h_find); OH_MessageBox( "More than one ini-file in OpenHoldem-directory.\n" "Don't know which one to use.\n" "\n" "Going to terminate...", "ERROR", 0); PostQuitMessage(-1); return "a_result_to_make_the_compiler_happy.ini"; } FindClose(h_find); // Exactly one ini-file found return ini_filename; }
CString CFilenames::OpenPPLLibraryPath() { CString result = OpenHoldemDirectory() + "\\OpenPPL_Library.ohf"; Log("OpenPPLLibraryPath", result.GetString()); return result; }
CString CFilenames::VersusPath() { CString result = OpenHoldemDirectory() + "versus.bin"; Log("VersusPath", result.GetString()); return result; }