ugh, handle absolute as well as relative paths
This commit is contained in:
parent
f311013200
commit
53c35241fb
|
@ -23,3 +23,11 @@ Lua is dynamically typed. Tests can't patch over lack of type-checking.
|
|||
|
||||
* Like any high-level language, it's easy to accidentally alias two non-scalar
|
||||
variables. I wish there was a way to require copy when assigning.
|
||||
|
||||
### Todo list
|
||||
|
||||
* Initializing settings:
|
||||
- from previous session
|
||||
- Filename as absolute path
|
||||
- Filename as relative path
|
||||
- from defaults
|
||||
|
|
6
main.lua
6
main.lua
|
@ -318,11 +318,15 @@ function love.quit()
|
|||
end
|
||||
-- save some important settings
|
||||
local x,y,displayindex = love.window.getPosition()
|
||||
local filename = Filename
|
||||
if filename:sub(1,1) ~= '/' then
|
||||
filename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
|
||||
end
|
||||
local settings = {
|
||||
x=x, y=y, displayindex=displayindex,
|
||||
width=App.screen.width, height=App.screen.height,
|
||||
font_height=Font_height,
|
||||
filename=love.filesystem.getWorkingDirectory()..'/'..Filename, -- '/' should work even on Windows
|
||||
filename=filename,
|
||||
screen_top=Screen_top1, cursor=Cursor1}
|
||||
love.filesystem.write('config', json.encode(settings))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue