about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-09-10 19:25:00 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-09-10 19:25:00 -0700
commitb23269f3e03b69e914f8f6311e9c873508619949 (patch)
treeca949c11b8b82602fb73ceebab2acafc9e3980ea
parent901dd1fd945588c3c8334ca86d57726911c3a908 (diff)
parent511db8cffd808d244aa84095bcde83def48736e0 (diff)
downloadview.love-b23269f3e03b69e914f8f6311e9c873508619949.tar.gz
Merge lines.love
-rw-r--r--edit.lua2
-rw-r--r--run.lua5
-rw-r--r--source.lua5
-rw-r--r--source_edit.lua2
4 files changed, 8 insertions, 6 deletions
diff --git a/edit.lua b/edit.lua
index 962949a..dae6d77 100644
--- a/edit.lua
+++ b/edit.lua
@@ -59,7 +59,7 @@ function edit.initialize_state(top, left, right, font_height, line_height)  -- c
     right = right,
     width = right-left,
 
-    filename = love.filesystem.getUserDirectory()..'/lines.txt',
+    filename = love.filesystem.getUserDirectory()..'/lines.txt',  -- '/' should work even on Windows
     next_save = nil,
 
     -- undo
diff --git a/run.lua b/run.lua
index 11534aa..16857f9 100644
--- a/run.lua
+++ b/run.lua
@@ -136,8 +136,9 @@ function run.settings()
     Settings.x, Settings.y, Settings.displayindex = love.window.getPosition()
   end
   local filename = Editor_state.filename
-  if filename:sub(1,1) ~= '/' then
-    filename = love.filesystem.getWorkingDirectory()..'/'..filename  -- '/' should work even on Windows
+  local os_path_separator = package.config:sub(1,1)
+  if filename:sub(1,1) ~= os_path_separator then
+    filename = love.filesystem.getWorkingDirectory()..os_path_separator..filename
   end
   return {
     x=Settings.x, y=Settings.y, displayindex=Settings.displayindex,
diff --git a/source.lua b/source.lua
index 8653a91..f4527ca 100644
--- a/source.lua
+++ b/source.lua
@@ -257,8 +257,9 @@ function source.settings()
     Settings.source.x, Settings.source.y, Settings.source.displayindex = love.window.getPosition()
   end
   local filename = Editor_state.filename
-  if filename:sub(1,1) ~= '/' then
-    filename = love.filesystem.getWorkingDirectory()..'/'..filename  -- '/' should work even on Windows
+  local os_path_separator = package.config:sub(1,1)
+  if filename:sub(1,1) ~= os_path_separator then
+    filename = love.filesystem.getWorkingDirectory()..os_path_separator..filename
   end
 --?   print('saving source settings', Settings.source.x, Settings.source.y, Settings.source.displayindex)
   return {
diff --git a/source_edit.lua b/source_edit.lua
index bcb1297..34752d0 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -100,7 +100,7 @@ function edit.initialize_state(top, left, right, font_height, line_height)  -- c
     right = right,
     width = right-left,
 
-    filename = love.filesystem.getUserDirectory()..'/lines.txt',
+    filename = love.filesystem.getUserDirectory()..'/lines.txt',  -- '/' should work even on Windows
     next_save = nil,
 
     -- undo