mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Avoid null termination issues on long paths.
This commit is contained in:
parent
3cb474047b
commit
5452129dfe
1 changed files with 6 additions and 5 deletions
|
@ -154,19 +154,20 @@ UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams ¶ms) {
|
|||
cheatFile = activeCheatFile;
|
||||
// Can't rely on a .txt file extension to auto-open in the right editor,
|
||||
// so let's find notepad
|
||||
wchar_t notepad_path[MAX_PATH];
|
||||
GetSystemDirectory(notepad_path, sizeof(notepad_path) / sizeof(wchar_t));
|
||||
wchar_t notepad_path[MAX_PATH + 1];
|
||||
GetSystemDirectory(notepad_path, MAX_PATH);
|
||||
wcscat(notepad_path, L"\\notepad.exe");
|
||||
|
||||
wchar_t cheat_path[MAX_PATH];
|
||||
wcscpy(cheat_path, ConvertUTF8ToWString(cheatFile).c_str());
|
||||
wchar_t cheat_path[MAX_PATH + 1] = {0};
|
||||
wcsncpy(cheat_path, ConvertUTF8ToWString(cheatFile).c_str(), MAX_PATH);
|
||||
// Flip any slashes...
|
||||
for (size_t i = 0; i < wcslen(cheat_path); i++) {
|
||||
if (cheat_path[i] == '/')
|
||||
cheat_path[i] = '\\';
|
||||
}
|
||||
|
||||
wchar_t command_line[MAX_PATH * 2 + 1];
|
||||
// One for the space, one for the null.
|
||||
wchar_t command_line[MAX_PATH * 2 + 1 + 1];
|
||||
wsprintf(command_line, L"%s %s", notepad_path, cheat_path);
|
||||
|
||||
STARTUPINFO si;
|
||||
|
|
Loading…
Add table
Reference in a new issue