2023-07-16 22:47:49 +01:00
|
|
|
on.initialize = function(arg)
|
2023-10-20 08:04:23 +01:00
|
|
|
if #arg == 0 then
|
2023-10-20 08:10:07 +01:00
|
|
|
if Data_dir == nil then
|
|
|
|
error('please provide a directory to browse')
|
|
|
|
end
|
2023-10-20 08:04:23 +01:00
|
|
|
else
|
2023-10-20 08:10:07 +01:00
|
|
|
if is_absolute_path(arg[1]) then
|
|
|
|
Data_dir = arg[1]
|
|
|
|
else
|
|
|
|
Data_dir = App.current_dir..arg[1]
|
|
|
|
end
|
2023-07-16 22:47:49 +01:00
|
|
|
end
|
2023-10-20 08:00:38 +01:00
|
|
|
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.')
|
2023-07-16 22:47:49 +01:00
|
|
|
end
|
2023-10-20 08:00:38 +01:00
|
|
|
local comment_path = Data_dir..'/comments'
|
2023-07-16 22:47:49 +01:00
|
|
|
if not file_exists(comment_path) then
|
2023-10-20 08:13:01 +01:00
|
|
|
App.mkdir(comment_path)
|
2023-07-16 22:05:19 +01:00
|
|
|
end
|
2023-06-22 06:22:13 +01:00
|
|
|
reset_viewport()
|
2023-06-21 06:32:36 +01:00
|
|
|
love.graphics.setFont(love.graphics.newFont(20))
|
2023-06-21 03:35:32 +01:00
|
|
|
local font = love.graphics.getFont()
|
|
|
|
font:setLineHeight(1.3)
|
2023-06-22 06:22:13 +01:00
|
|
|
initialize_file_picker()
|
|
|
|
A()
|
2023-06-24 06:45:55 +01:00
|
|
|
Viewport.x, Viewport.y = Viewport_bounds.xmin, Viewport_bounds.ymin
|
|
|
|
B()
|
2023-10-20 08:00:38 +01:00
|
|
|
end
|