remyroy / CDDA-Game-Launcher

A Cataclysm: Dark Days Ahead launcher with additional features
MIT License
424 stars 105 forks source link

Upgrading CDDA fails and CDDA folder left in inconsistent state #366

Open KongMD-Steam opened 5 years ago

KongMD-Steam commented 5 years ago

Describe the bug When I upgrade my build of the game, the CDDA Launcher fails to update it and data is lost. I lose all of the data in my data/Sound/MySoundpack folder and the executable is moved to previous_version with nothing else.

Expected behavior The game updates itself via the launcher successfully. A previous_version folder is created with the old version.

To Reproduce Steps to reproduce the behavior:

  1. Open the launcher and press 'Upgrade Game' button

  2. I receive the following message, after the launcher downloads the build: Screenshot - 7_13_2019 , 12_07_40 PM

  3. I hit Continue, then get this message: Screenshot - 7_13_2019 , 12_08_53 PM

  4. Pressing 'Try Again' doesn't work. I eventually hit 'Cancel'.

  5. The launcher give me this message in the status bar: Screenshot - 7_13_2019 , 12_09_51 PM

  6. All of the data in my Sound folder is gone, and the only item in 'previous_version' is the cataclysm-tiles.exe executable

  7. At this point, I revert everything CDDA Launcher has done and manually update the game myself, using the .zip backup I made before starting the upgrade process.

Additional context Install directory: C:\Program Files\CDDA Launcher\CDDA Game Launcher Game directory: C:\Games\CataclysmDDA Windows 8.1 x64 Latest release of the CDDA Launcher

KurzedMetal commented 5 years ago

Can you open the folder %localappdata%\CDDA Game Launcher and upload the app.log file here? I'm wondering if it has any useful information in there.

KongMD-Steam commented 5 years ago

There's nothing useful in that log, I'm afraid. It's lines like this over and over, with no extra information: 2019-07-13 12:02:56,785 - cddagl - INFO - CDDA Game Launcher started: 1.4.1

KurzedMetal commented 5 years ago

Ok... The code in this case is trying to move config folder into previous_version as part of a Backup process (moves all existing files in previous_version). I have no idea why it ask him for permissions for previous_version, but I don't think that's the problem.

The problem starts with config being in use by another process (not sure what could be in his PC), and the directory can't be moved. I also seen other players report similar behaviors in Discord, although with no much information: if files are in use, Launcher ends up corrupting their installations and saves.

Then, when he gives up and press "Cancel" he is telling the Launcher that the Move operation failed. And here is what could be improved from the Launcher: After the failure, it just stop the backups and does nothing more... So it leaves you with a half backup and half installation, which is quite bad.

I think this only happens because the whole process is based on moving files, IMO it should either be copying or archiving them (I'd prefer the later), but I'm guessing that Remy (main dev) opted for moving them for performance reasons.

@remyroy Am I right about the last assumption? Is that part doing a "move" for performance reasons? was that part of the code ever using copy/archive operations instead of move_path(). Any opinion in the approach you'd take on this?

BTW, I reproduced this easily by opening a cmd console and cding to the config folder: that makes the directory be in use by the cmd.exe process and breaks the move_path() function like the OP reported. There may be other ways, that's the simplest I could think.

Daedracian commented 4 years ago

so i have a similar issue of the folder simply not existing after reading this i troubleshooted creating an empty folder folder with the same name every thing goes well until it asks to delete the folder i click continue and i get prompted with this cdda error prompt cdda error prompt 2 not sure if this needs a new thread