!include NonExistantFile.txt causes error message without a filename mentioned at all.
Issue: Using !include within config.txt (and possibly in other files that are allowed to use !include) will cause OpenKore to exit graacefully, but with a useless message stating:
Unable to load the file .
Symptoms: _Steps to recreate:_
- Insert an include directive in control/config.txt that calls a file/path that does not exist. e.g.: !include foo.txt
- Save said changes, and launch openkore using that config.txt
Nota Bene: If you are using the Console::Curses interface like I was, you will not catch this error unless you are logging your console using logConsole 1 or change the interface to plain ol' Console.
What I saw in my case:
Use of the encoding pragma is deprecated at plugins/macro/Macro/Parser.pm line 5. *** OpenKore what-will-become-2.1 ( version bc07ae7_2016-10-14 ) - Custom Ragnarok Online client *** *** http://www.openkore.com/ ***
Selectively loading plugins... Loading plugin plugins/breakTime/breakTime.pl... Loading plugin plugins/macro/macro.pl...
Loading control/config.txt... Unable to load the file . Benchmark results saved to benchmark-results.txt macro plugin unloading, cleaning up *** OpenKore what-will-become-2.1 ( version bc07ae7_2016-10-14 ) - Custom Ragnarok Online client *** *** http://www.openkore.com/ ***
Okay, okay, I fibbed a little - I've sanitized the path to config.txt so I don't show the world my settings or account info. But this is otherwise exactly what I saw to cause this issue.
Info _OS:_
Ubuntu 16.04.1 LTS
Using the server distro, if that matters. Kernel issue from "uname"
4.4.0-42-generic GNU/Linux
_Perl:_
perl --version
This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi (with 58 registered patches, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
_Openkore:_
*** OpenKore what-will-become-2.1 ( version bc07ae7_2016-10-14 ) - Custom Ragnarok Online client
Cause:
Using grep, it looks like src/FileParsers.pm and src/Utils/TextReader.pm (called by FileParsers.pm) are both involved. Beyond that, I haven't any insight.
Solutions: For the user:
- Check for malformed/mistyped !include file-paths in your control files for your account/character
- Remember to check for !include statements within files called by another !include -- this is what I had happen to me.
For the developers:
- FileParsers.pm and TextReader.pm look to be the source files involved with this issue.
- Seems to be that there is no filename for the include snippets when the error "Unable to load the file %s." message is processed.
- Fixing the error message so the included file (and/or the whole filepath in the !include that causes the error) would be a better solution.
- There are tests for both these units, but it seems though the tests don't deal with an error case like an invalid file was passed.
- Perhaps expanding the test suite to deal with this situation would be wise.