philmasterplus
Active member
file_to_map()
is extremely forgiving. It will return true
if:- The file does not exist
- The file's contents do not match the map used
- The file is a binary file (e.g. KoLmafia's own JAR file)
- The file path is empty or invalid (e.g.
"!@#$%^"
) - The file path is actually a directory (e.g.
"data/"
) - The file path is outside KoLmafia's root directory
- The file path is a nonexistent URL (e.g.
"http://www.please-return-false.com/"
)
"http://"
causes the script to abort. Nevertheless, the return value is unhelpful.This behavior has been around for a long time. I checked as far as KoLmafia v12.0 (released on 2008), and
file_to_map()
still returned true
for nonexistent files. I therefore assume it's not a bug.Is the return value relevant at all? It seems the function always returns
true
.