Skip to content

Commit

Permalink
Enabled actual killing/opening of File Explorer instances in refresh_…
Browse files Browse the repository at this point in the history
…file_explorer. #115.
  • Loading branch information
end2endzone committed Jan 9, 2024
1 parent 806b3f5 commit 75a197c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/refresh_file_explorer/file_explorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ bool KillFileExplorerProcesses()
for (size_t i = 0; i < process_ids.size(); i++)
{
const ra::process::processid_t pid = process_ids[i];
bool killed = true; // ra::process::Kill(pid);
bool killed = ra::process::Kill(pid);
if (!killed)
return false;
}
Expand Down
44 changes: 22 additions & 22 deletions src/refresh_file_explorer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,32 +235,32 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
SendMessage(hWnd, WM_USER_KILL_FILE_EXPLORER, 0, 0);
break;
case WM_USER_KILL_FILE_EXPLORER:
//killed = KillFileExplorerProcesses();
//if (!killed)
//{
// std::wstring str;
// str += L"Failed killing all File Explorer processes.";
// ShowErrorMessage(hWnd, str);
// PostQuitMessage(EXIT_PROCESS_KILL_FAILED);
// return 0;
//}
killed = KillFileExplorerProcesses();
if (!killed)
{
std::wstring str;
str += L"Failed killing all File Explorer processes.";
ShowErrorMessage(hWnd, str);
PostQuitMessage(EXIT_PROCESS_KILL_FAILED);
return 0;
}
// Continue with next step
SendMessage(hWnd, WM_USER_RESTORE_FILE_EXPLORER, 0, 0);
break;
case WM_USER_RESTORE_FILE_EXPLORER:
//for (size_t i = 0; i < paths_backup.size(); i++)
//{
// const std::string& path_utf8 = paths_backup[i];
// bool opened = OpenFileExplorerWindow(path_utf8);
// if (!opened)
// {
// std::wstring str;
// str += L"Failed to open directory '";
// str += ra::unicode::Utf8ToUnicode(path_utf8);
// str += L"'. Press OK to continue.";
// ShowErrorMessage(hWnd, str);
// }
//}
for (size_t i = 0; i < paths_backup.size(); i++)
{
const std::string& path_utf8 = paths_backup[i];
bool opened = OpenFileExplorerWindow(path_utf8);
if (!opened)
{
std::wstring str;
str += L"Failed to open directory '";
str += ra::unicode::Utf8ToUnicode(path_utf8);
str += L"'. Press OK to continue.";
ShowErrorMessage(hWnd, str);
}
}

// Remember which paths we need to restore.
paths_missing = paths_backup;
Expand Down

0 comments on commit 75a197c

Please sign in to comment.