Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve file deletion error while the game is running #3938

Merged
merged 3 commits into from Dec 6, 2023

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Dec 6, 2023

Motivation

When you launch KSP1 on Windows, it locks either many or all of the mods' files. If you then try to uninstall those mods with CKAN while the game is still running, you get a hard to understand message that mentions the file but gives no information about why the problem happened or what you can do about it:

before

Brought up by @JonnyOThan on Discord.

Changes

  • Now the message is reformatted to be more understandable:

    Unable to overwrite or delete files for MyMod:

    GameData\MyMod\MyMod.dll

    If the game is still running, close it and try again. Otherwise check the permissions.

    • The top line states simply that we were trying to delete files and could not
    • The bottom line says to close the game and check permissions
    • The file list is now relative to game root and uses local OS path separators (backslash on Windows)
  • Now the changeset warns the user to close the game before applying changes that involve deletion:
    changeset after
  • At some point, .NET added an Enum.HasFlag() function for checking flag-style enums; previously you had to use bitwise AND and a comparison. Now we use the new function.

@HebaruSan HebaruSan added Enhancement GUI Issues affecting the interactive GUI Core (ckan.dll) Issues affecting the core part of CKAN Windows Issues specific for Windows labels Dec 6, 2023
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, this has been a common one to confuse people. Thanks @HebaruSan !

@HebaruSan HebaruSan merged commit 3cb63bb into KSP-CKAN:master Dec 6, 2023
8 checks passed
@HebaruSan HebaruSan deleted the fix/file-locked-errors branch December 12, 2023 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement GUI Issues affecting the interactive GUI Windows Issues specific for Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants