Start a new topic

Using mgOpenDb() to open a bad/corrupt flt file deletes the file?

Original Post by: IanCheung Wed Nov 10 16:41:27 2010

I've just been playing around with mgOpenDb and noticed something strange - maybe everything is fine and it works as intended, however... just to run through my test quickly:

1. I create an empty .txt file in windows explorer.

2. I rename and change its file type to be "badFlightFile.flt"

3. In python, I run

db = mgOpenDb("badFlightFile.flt")

Result: Error is thrown, and then badFlightFile.flt is deleted.

Is this correct behaviour? If so, why delete the file?


Original Post by: SteveThompson Wed Nov 10 16:52:45 2010

That certainly does not sound right... let us look into this and get back to you...

Original Post by: SteveThompson Thu Dec 9 01:48:52 2010

I finally had a chance to give this a try. It does appear to delete the file... but ONLY if the file is 0 bytes long. I'm not trying to excuse the behavior, mind you... probably something historical in the code that does this. The good news is that you won't ever really lose any data (because if the file contained something at all, it won't be deleted), but it will delete the file if it was completely empty.

Either way, I'll log a bug. Thanks for the heads up.

Original Post by: SteveThompson Thu Dec 9 01:50:52 2010

Looks like Creator does the same thing. If you try to File>Open a zero-length .flt file, it gets deleted. Ugh.

Original Post by: IanCheung Thu Dec 9 10:55:31 2010

Ok, and like you said - it's not really a problem that has any real impact on anything, it was just an odd thing that I happened to spot

Login to post a comment