Author Topic: [FIXED][BIG BUG][FLEXI] Renaming ranks can cause data loss.  (Read 1229 times)

0 Members and 1 Guest are viewing this topic.

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
[FIXED][BIG BUG][FLEXI] Renaming ranks can cause data loss.
« on: March 20, 2018, 03:09:49 AM »
Steps to reproduce:
1. BACK UP YOUR PACK DATA BEFORE PROCEEDING!!!
2. Load a pack in Flexi.
3. Rename a rank.
4. Save the pack twice. (You can do stuff inbetween the two saves.)

Result: All level files in at least that rank (possibly later ranks too) get deleted and saving fails on the second save. (That rank's levels.nxmi file will be valid, though.)

I suspect this is a result of the Flexi Toolkit trying to copy files from their original location when saving. The bug would then seem to be, on the first save, the toolkit does not update the source file path to correspond to where it just saved the level to. As such, on the second save, the original file is missing - but this occurs after clearing out the target folder - and thus the save fails.

On a side note, this can also occur if eg. you add a level from outside the project folder, then delete the source file. In this case, it will only affect that level onwards (earlier levels in the same rank will be fine).

Old-formats Flexi avoided this issue by loading *all* level files (and images etc) into memory rather than relying on the file from the hard disk. This has its downsides too, in that data loss can occur if the user modified the (at the time) LVL file while Flexi was open, then hit Save in Flexi. Possible solution: Store a copy in memory, as well as the source location, and the modified time of the file at the time it was loaded. When attempting to save, check if source file exists. If it exists and has a newer modified time than the copy in memory, use it; otherwise, use the copy in memory.
« Last Edit: March 20, 2018, 11:14:44 AM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline IchoTolot

  • Global Moderator
  • Posts: 3612
    • View Profile
Re: [BIG BUG][FLEXI] Renaming ranks can cause data loss.
« Reply #1 on: March 20, 2018, 11:06:37 AM »
This could possibly be related to: https://www.lemmingsforums.net/index.php?topic=3761.0

Quote
There was even an actual error message that I couldn't explain why it was appearing when saving over my pack.
It said there were levels/files currently currently being used by a program, while only the pack toolkit was running. The 2nd save succeeded then without the error. So it seems like the first save attempt is a bit buggy.

Offline Nepster

  • Posts: 1829
    • View Profile
Re: [BIG BUG][FLEXI] Renaming ranks can cause data loss.
« Reply #2 on: March 20, 2018, 04:50:49 PM »
Thanks for the bug report. I already know where the bug lies: When saving a pack, the file paths of the levels (which are stored internally) are not updated. Will be fixed soon.

Offline Nepster

  • Posts: 1829
    • View Profile
Re: [BIG BUG][FLEXI] Renaming ranks can cause data loss.
« Reply #3 on: March 20, 2018, 06:26:42 PM »
And done...