diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-08-30 22:30:20 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-08-30 22:30:20 -0700 |
commit | 06ad5c4e8ce1c4a78db7eb11b680758fab68cc69 (patch) | |
tree | 0ddd56e04a22b02e8d0b5c080e9f173c8e6091d0 | |
parent | f82c0de5020437bf45afa8d4e441437801466af6 (diff) | |
download | view.love-06ad5c4e8ce1c4a78db7eb11b680758fab68cc69.tar.gz |
bugfix in source editor
We now need to explicitly select the directory we want to read from.
-rw-r--r-- | source_file.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source_file.lua b/source_file.lua index d285e0d..b0e26eb 100644 --- a/source_file.lua +++ b/source_file.lua @@ -1,7 +1,10 @@ -- primitives for saving to file and loading from file function file_exists(filename) - local infile = App.open_for_reading(filename) + local infile = App.open_for_reading(App.save_dir..filename) + if not infile then + infile = App.open_for_reading(App.source_dir..filename) + end if infile then infile:close() return true @@ -10,9 +13,12 @@ function file_exists(filename) end end --- the source editor supports only files in the save dir, not even subdirectories +-- the source editor supports only files in the save dir backed by the source dir function load_from_disk(State) local infile = App.open_for_reading(App.save_dir..State.filename) + if not infile then + infile = App.open_for_reading(App.source_dir..State.filename) + end State.lines = load_from_file(infile) if infile then infile:close() end end |