@ -82,7 +82,38 @@ function core.init()
CommandView = require " core.commandview "
Doc = require " core.doc "
-- load config before anything
core.frame_start = 0
core.clip_rect_stack = { { 0 , 0 , 0 , 0 } }
core.log_items = { }
core.docs = { }
core.threads = setmetatable ( { } , { __mode = " k " } )
core.project_files = { }
core.redraw = true
command.add_defaults ( )
-- FIXME: this can load plugins before any thread is started resulting in
-- their failure
core.try ( require , " user " )
-- get the last open dir or open HOME
local project_dir = os.getenv ( " HOME " ) or ' / '
if config.restore_last_dir then
local info = system.get_file_info ( USERDIR .. ' /last_dir ' )
if info and info.type == " file " then
local file = io.open ( USERDIR .. ' /last_dir ' )
if file then
local last_dir = file : read ( )
file : close ( )
if last_dir then
info = system.get_file_info ( last_dir )
if info and info.type == " dir " then
project_dir = last_dir
end
end
end
end
end
local files = { }
for i = 2 , # ARGS do
local info = system.get_file_info ( ARGS [ i ] ) or { }
@ -93,15 +124,12 @@ function core.init()
end
end
system.chdir ( project_dir )
-- write project dir to log file
local d = io.open ( USERDIR .. ' /last_dir ' , " w " )
d : write ( tostring ( system.absolute_path ( project_dir ) ) )
d : close ( )
core.frame_start = 0
core.clip_rect_stack = { { 0 , 0 , 0 , 0 } }
core.log_items = { }
core.docs = { }
core.threads = setmetatable ( { } , { __mode = " k " } )
core.project_files = { }
core.redraw = true
system.chdir ( project_dir )
core.root_view = RootView ( )
core.command_view = CommandView ( )
@ -111,9 +139,7 @@ function core.init()
core.root_view . root_node.b : split ( " down " , core.status_view , true )
core.add_thread ( project_scan_thread )
command.add_defaults ( )
local got_plugin_error = not core.load_plugins ( )
core.try ( require , " user " )
local got_project_error = not core.load_project_module ( )
for _ , filename in ipairs ( files ) do