diff --git a/0012-on.initialize b/0012-on.initialize index 5687e21..ec64394 100644 --- a/0012-on.initialize +++ b/0012-on.initialize @@ -1,13 +1,16 @@ on.initialize = function(arg) if #arg > 0 then - Data_dir = arg[1] + if is_absolute_path(arg[1]) then + Data_dir = arg[1] + else + Data_dir = App.current_dir..arg[1] + end end - local repo_path = love.filesystem.getSaveDirectory()..'/'..Data_dir - print('reading articles from '..repo_path) - if not file_exists(repo_path) then - error('no directory '..repo_path..' found. Please store articles to browse there before opening this app.') + print('reading articles from '..Data_dir) + if not file_exists(Data_dir) then + error('no directory '..Data_dir..' found. Please store articles to browse there before opening this app.') end - local comment_path = repo_path..'/comments' + local comment_path = Data_dir..'/comments' if not file_exists(comment_path) then error('Sorry, I am not permitted to create directories (folders). Please create directory '..comment_path..' for storing comments in.') end @@ -19,4 +22,4 @@ on.initialize = function(arg) A() Viewport.x, Viewport.y = Viewport_bounds.xmin, Viewport_bounds.ymin B() -end \ No newline at end of file +end diff --git a/0121-full_path b/0121-full_path index 4f7b258..d7d54b6 100644 --- a/0121-full_path +++ b/0121-full_path @@ -1,3 +1,3 @@ full_path = function(id) - return App.save_dir..Data_dir..'/'..id + return Data_dir..'/'..id end diff --git a/0129-initialize_file_picker b/0129-initialize_file_picker index 644ff97..ff70696 100644 --- a/0129-initialize_file_picker +++ b/0129-initialize_file_picker @@ -1,5 +1,5 @@ initialize_file_picker = function() - Files = love.filesystem.getDirectoryItems(Data_dir) + Files = App.files(Data_dir) for i=#Files,1,-1 do if not Files[i]:match('%.md$') then table.remove(Files, i) @@ -16,4 +16,4 @@ initialize_file_picker = function() border={r=0.4, g=0.4, b=0.7} }) end -end \ No newline at end of file +end diff --git a/0152-Data_dir b/0152-Data_dir index 911c1b4..e162e0a 100644 --- a/0152-Data_dir +++ b/0152-Data_dir @@ -1 +1 @@ -Data_dir = 'data' \ No newline at end of file +Data_dir = App.save_dir .. 'data' \ No newline at end of file