Customized fork of github.com/rxi/lite

Fixed changing of cwd and loading of commandline files

the current-working-directory is now set at the start of `core.init` after the
absolute path for all filename arguments have been resolved

rxi 064b6d0b 257b9ab7

Changed files
+15 -9
data
core
+15 -9
data/core/init.lua
··· 82 82 CommandView = require "core.commandview" 83 83 Doc = require "core.doc" 84 84 85 + local project_dir = "." 86 + local files = {} 87 + for i = 2, #ARGS do 88 + local info = system.get_file_info(ARGS[i]) or {} 89 + if info.type == "file" then 90 + table.insert(files, system.absolute_path(ARGS[i])) 91 + elseif info.type == "dir" then 92 + project_dir = ARGS[i] 93 + end 94 + end 95 + 96 + system.chdir(project_dir) 97 + 85 98 core.frame_start = 0 86 99 core.clip_rect_stack = {{ 0,0,0,0 }} 87 100 core.log_items = {} ··· 103 116 local got_user_error = not core.try(require, "user") 104 117 local got_project_error = not core.load_project_module() 105 118 106 - for i = 2, #ARGS do 107 - local filename = ARGS[i] 108 - local info = system.get_file_info(filename) 109 - if info and info.type == "file" then 110 - core.root_view:open_doc(core.open_doc(filename)) 111 - end 119 + for _, filename in ipairs(files) do 120 + core.root_view:open_doc(core.open_doc(filename)) 112 121 end 113 122 114 123 if got_plugin_error or got_user_error or got_project_error then 115 124 command.perform("core:open-log") 116 125 end 117 - 118 - local info = ARGS[2] and system.get_file_info(ARGS[2]) 119 - system.chdir(info and info.type == "dir" and ARGS[2] or ".") 120 126 end 121 127 122 128