Images Folder: Help

Honest

New member
First time using Mafia, i placed it on my desktop. It seems like the Images folder Mafia automatically created replaced a folder i had named "Images" on the desktop. Was this supposed to happen? Is there any way to get my old folder back? i had a lot of pictures in it :(

Thanks, sorry if this isn't the right place to ask these kind of questions

KoLMafia-14777
 

Bale

Minion
That's odd. I would think that your pictures and the images downloaded from KoL would be intermingling in the same folder. If there is a folder of the same name used by mafia, it is used. Are you sure they are gone? I suspect they are still there.

I recommend that you put KoLmafia in its own folder to prevent that kind of thing from happening.
 

Honest

New member
yeah, i really hoped it was intermingling and that my pictures were still in the folder, but i really can't find them any more. i've moved KoLMafia in its own folder and it automatically created a bunch of folders again, but nothing else has changed :/
 

Theraze

Active member
Well, if you have VSC enabled, you might be able to get a previous versions on the folder and get the images back... but barring that, you're probably stuck.
 

lostcalpolydude

Developer
Staff member
Looking at the code, I would only expect mafia to make the folder if it doesn't already exist. Unless that function considers Images and images to be different...
 

fronobulax

Developer
Staff member
Looking at the code, I would only expect mafia to make the folder if it doesn't already exist. Unless that function considers Images and images to be different...

I don't know which function is being used but whether a Windows system is case sensitive or insensitive depends upon several things including user configured options, FAT vs NTFS and whether 8.3 file support is present. If it were my images folder and I had no backup I would hope that mafia really created images, did not destroy Images and then look at the disk with some tool that is case sensitive at the core. I have no idea what could have happened if it isn't Windows...
 

roippi

Developer
Looking at the code, I would only expect mafia to make the folder if it doesn't already exist. Unless that function considers Images and images to be different...

I wouldn't expect mkdirs() to mess with any contents of a pre-existing images (or Images) folder.

I would expect RelayRequest.clearImageCache() - which is done on the first startup - to delete pretty much everything in there, though.

OP, I suspect your images are gone for good, unless you had them backed up somewhere. Sorry.
 

lostcalpolydude

Developer
Staff member
This is Windows for sure, because the other folders were made in the same place that mafia was run from. (It's possible to do that with other OSs, but it seems safe to assume that someone using mafia for the first time doesn't know it's a thing. I don't even know how to do that without looking it up.) Mafia is calling mkdirs(), and I have no idea how case is handled from there.

Edit: roippi's response above sounds right.
 

lostcalpolydude

Developer
Staff member
I can't think of a good fix for this. Probably the best that can be done is somehow checking if it's the first time opening mafia where folders would be made in that location (not sure how to do that, maybe have a setting with some default value that is immediately changed), then if it is the first time and those folders exist, display an error message and exit. That method wouldn't work for existing mafia users, though.
 

Razorsoup

Member
Honest: If you can't recover your photos from a backup or similar source, your next best bet might be to try a file recovery program like Recuva*. Due to the way Windows usually deletes files the data may still exist on your hard drive and be accessible to the right program. The sooner you can try something like this, the better your odds of recovery are. Barring that, I don't know that there is really anything else you could do.

*note: there are quite a few such programs out, this is just a free one who's name I could immediately remember.
 

lostcalpolydude

Developer
Staff member
Note that while it is bad that mafia deleted some non-mafia files, this type of weirdness is just one of many reasons why you should have backups of important files. Hard drive failure can happen without warning, a pet can jump on your keyboard, plenty of things can make those essential files disappear forever.
 

fronobulax

Developer
Staff member
I would expect RelayRequest.clearImageCache() - which is done on the first startup - to delete pretty much everything in there, though.

Which does raise the question, could or should we do anything to reduce the chances of this happening again? Anything could range from a note in the installation instructions that says "Don't install mafia except in an empty folder (directory)" and we can dismiss the next report with "RTFM, n00b" to making the image cache clearing nuanced so that (based on looking at my images folder) it only clears gif files or files that KoLmafia is likely to have stored?

I'm raising the question although I am leaning towards just adding a warning to the install install instructions where ever they may be. I recognize that trying to protect users from every possible mistake leads to fragile and hard to maintain code.
 

lostcalpolydude

Developer
Staff member
I don't think there's a good way to add something to this sourceforge page. Fewyn could add something to the daily builds download page, but I don't think it would make any difference because people wouldn't read it. Short of people in chat knowing about the issue and mentioning it along with mentioning mafia to new users, I don't think any non-technical effort will matter, but a message of "be careful or your files will be deleted" probably isn't a message to encourage new people to use mafia.

I suppose mafia could create a file in each of its folders that does nothing except let mafia later check that it created the folders. Adding those files would probably need to happen before one point release, and checking for them would need to happen a bit later. I don't know what the code for that would look like yet.
 

Darzil

Developer
I would expect RelayRequest.clearImageCache() - which is done on the first startup - to delete pretty much everything in there, though.
What is the advantage of this? Surely if Mafia has just created the folder it'd already be clear (except where someone has images there) ?
 

lostcalpolydude

Developer
Staff member
It was relevant when that was first added, so that mafia could remove images that said they were good for the rest of time and cache images with the correct expiration date. I think.
 
Top