PDA

View Full Version : Checking for files?



Nightmist
10-12-2006, 07:13 AM
Is there currently any way to get mafia to "check if a local file exists"? (As far as I understand the file_to_map is a void so no boolean checking that.)

Just curious since my trade response script throws a hissy-fit at the moment when a certain local file which is ment to hold "History" isn't found. I could make a custom preference for "Has been run before" but then if they do the "delete the data folder" type fix for their kolmafia it would wipe that setting which would end up wiping the history...

holatuwol
10-12-2006, 11:10 AM
It returned a boolean value, but a not-very-informative one if you were reading a value that didn't exist. I'll go ahead and fix this and make the return value be false when the file doesn't exist.

Nightmist
10-12-2006, 11:30 PM
Yay! No more:

File not located: scripts/datamaps/LatestTradeRecords.txt
File not located: scripts/LatestTradeRecords.txt
File not located: data/LatestTradeRecords.txt
File not located: LatestTradeRecords.txt
Could not locate local file
Script aborted!
Or would it print that but just not abort? Since the whole telling us where its looking for the local file is kind of helpful.