Skip to content

Commit dae895e

Browse files
author
cspangler
committed
Fixed game config file selector dialog
1 parent 5f0449a commit dae895e

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

cfg-switcher/WinUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ std::string BrowseFile(std::string prompt) {
8787
ofn.nFilterIndex = 2;
8888
ofn.lpstrFile = f1;
8989
ofn.nMaxFile = MAX_PATH;
90-
ofn.Flags = OFN_FILEMUSTEXIST;
90+
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
9191

9292
if (::GetOpenFileName(&ofn) != FALSE)
9393
return ofn.lpstrFile;

cfg-switcher/main.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,8 @@ int main() {
124124
}
125125
else if (gameID.empty() || (gameID.find_first_not_of(' ') == std::string::npos))
126126
break;
127-
std::cout << "Enter path to game config file: ";
128-
getline(std::cin, cfgPath);
129-
if (cfgPath.empty() || (cfgPath.find_first_not_of(' ') == std::string::npos))
130-
break;
131-
GetFileAttributes(cfgPath.c_str());
132-
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(cfgPath.c_str()) || GetLastError() == ERROR_FILE_NOT_FOUND)
133-
{
134-
std::cerr << "Error: Specified config file does not exist" << std::endl;
135-
break;
136-
}
137-
//std::cout << "Select directory containing the " << gameID << " config files..." << std::endl;
138-
//path = BrowseFile("Select directory containing the " + gameID + " config files...");
127+
std::cout << "Select directory containing the " << gameID << " config files..." << std::endl;
128+
cfgPath = BrowseFile("Select directory containing the " + gameID + " config files...");
139129
if (settings.addGame(gameID, cfgPath)) {
140130
std::cout << std::endl << "Successfully added " << gameID << " to configuration" << std::endl;
141131
}

0 commit comments

Comments
 (0)