support browsing directories outside save dir
This commit is contained in:
parent
189c0c9e75
commit
459b1df08a
|
@ -1,13 +1,16 @@
|
|||
on.initialize = function(arg)
|
||||
if #arg > 0 then
|
||||
if is_absolute_path(arg[1]) then
|
||||
Data_dir = arg[1]
|
||||
else
|
||||
Data_dir = App.current_dir..arg[1]
|
||||
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.')
|
||||
end
|
||||
local comment_path = repo_path..'/comments'
|
||||
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 = 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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
full_path = function(id)
|
||||
return App.save_dir..Data_dir..'/'..id
|
||||
return Data_dir..'/'..id
|
||||
end
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Data_dir = 'data'
|
||||
Data_dir = App.save_dir .. 'data'
|
Loading…
Reference in New Issue