Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow .. in relative filenames in wesnoth.dofile/require
This changes the lua loadfile code to store relative filenames (like ~add-ons/campaign1/lua/code.lua) the in descriptions attributes of lua codechunks. This not only makes the lua error messages easier to read (previously: 'error in C:\users\... ...ign1/lua/code.lua", now: "Error in ~add-ons/campaign1/lua/code.lua"). This also removes the possiblity for wml authors to query the wesnoth install directory path by using lua debug functions. We have to use a custom function resolve_filename() to resolve filenames that begin with "./" becasue get_wml_location() expects a abolsute directoy ("C:\users\....") as second parameter, and i didnt want to change it becasue it is also used by the wml proprocessor which i don't want to look at right now. Since i had to write a custom function resolve_filename() function anyway i decided to also put support for ../ and ./ in it, note that the results is passed to get_wml_location() anyway so all security checks that were there previously are still there.
- Loading branch information