| -rw-r--r-- | launcher.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/launcher.lua b/launcher.lua index 7d1dca1..0d1b97c 100644 --- a/launcher.lua +++ b/launcher.lua @@ -38,6 +38,13 @@ local i = 1; while i <= #arg do end end +if _WIN32 then + -- avoid paths with multi-byte characters at all costs + -- (for example, lfs.* and SDL.RWFromFile expect args in different charsets) + userDir = userDir or './userdata' + dataDir = dataDir or './data' +end + -- find user directory if not userDir then local appdataDir = require'win'.appdata() @@ -110,8 +117,7 @@ local function protectedLauncher() if not dataDir then -- find data directory (paths are in reverse priority order) - local try = { settings.datadir, - arg[0]:gsub('[/\\*]*[^/\\]*$', '')..'/data' } + local try = { settings.datadir, arg[0]:gsub('[^/\\]*$', '')..'data' } for _,dir in ipairs(try) do if lfs.attributes(dir..'/manifest.lua') then dataDir = dir end end assert(dataDir, "can't find data files in: "..table.concat(try, ", ")) |
