diff options
| author | a1xd <[email protected]> | 2021-02-26 21:50:35 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:36:19 -0400 |
| commit | 41d73f257a58905f273fce3195cb4c0f3cd5c165 (patch) | |
| tree | 33ed86b2257878a4102dc15b86e25875e13b172f /uninstaller/uninstaller.cpp | |
| parent | bump version, target win10 (diff) | |
| download | rawaccel-41d73f257a58905f273fce3195cb4c0f3cd5c165.tar.xz rawaccel-41d73f257a58905f273fce3195cb4c0f3cd5c165.zip | |
improve installer
use standard syntax for service binpath
throw if copy_file fails
Diffstat (limited to 'uninstaller/uninstaller.cpp')
| -rw-r--r-- | uninstaller/uninstaller.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/uninstaller/uninstaller.cpp b/uninstaller/uninstaller.cpp index bd9c564..3434cb7 100644 --- a/uninstaller/uninstaller.cpp +++ b/uninstaller/uninstaller.cpp @@ -14,22 +14,22 @@ int main() { } }); - fs::path target = get_target_path(); + fs::path target = expand(DRIVER_ENV_PATH); fs::path tmp = make_temp_path(target); - if (fs::exists(target) || fs::exists(tmp)) { + if (fs::exists(target)) { reboot_required = true; - } - // schedule tmp to be deleted if rename target -> tmp is successful - if (MoveFileExW(target.c_str(), tmp.c_str(), MOVEFILE_REPLACE_EXISTING)) { - MoveFileExW(tmp.c_str(), NULL, MOVEFILE_DELAY_UNTIL_REBOOT); - } - else { // tmp is in use and delete is already scheduled - if (fs::exists(target)) fs::remove(target); + // schedule tmp to be deleted if rename target -> tmp is successful + if (MoveFileExW(target.c_str(), tmp.c_str(), MOVEFILE_REPLACE_EXISTING)) { + MoveFileExW(tmp.c_str(), NULL, MOVEFILE_DELAY_UNTIL_REBOOT); + } + else { // tmp is in use and delete is already scheduled + fs::remove(target); + } } - if (reboot_required) { + if (reboot_required || fs::exists(tmp)) { std::cout << "Removal complete, change will take effect after restart.\n"; } else { |