about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-01 13:55:43 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-01 13:56:17 -0700
commit53c35241fb1fbc01412e8e7899f14b3929472162 (patch)
tree20b720fc695cf183fd8e6cad9d833710ef2fd72e /main.lua
parentf311013200bf62d28d3a548963c1e56f7c4ca3dc (diff)
downloadtext.love-53c35241fb1fbc01412e8e7899f14b3929472162.tar.gz
ugh, handle absolute as well as relative paths
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 1ba8e6d..17a19e5 100644
--- a/main.lua
+++ b/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