aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-12-28 16:01:49 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-12-28 16:01:49 +0100
commit35f164640de3d5554eafee9e4a06b0d722a27527 (patch)
treeedbf95073247b32f9a1652b962f9d4ae52bee96c
parent2cf3c6f7476d891cf3eb548409c109de315b3c6b (diff)
downloadlite-xl-fix-bug-removed-project.tar.gz
lite-xl-fix-bug-removed-project.zip
Check last used project before trying to use itfix-bug-removed-project
When starting the application try to uses the last recently used project but doesn't check if the directory actually exists. On windows that's okay because if it doesn't exist core.set_project_dir will fail and the application will fall back to use the current working directory. On linux on the other side it may cause an error with dmon because we attempt to watch a directory that doesn't exist. We now check that the directory actually exists before trying to use it. This is an attempt to fix: https://github.com/lite-xl/lite-xl/issues/774
-rw-r--r--data/core/init.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/data/core/init.lua b/data/core/init.lua
index 481fc431..602869af 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -704,7 +704,9 @@ function core.init()
core.previous_replace = session.previous_replace or {}
end
- local project_dir = core.recent_projects[1] or "."
+ local last_dir = core.recent_projects[1]
+ local last_dir_info = last_dir and system.get_file_info(last_dir)
+ local project_dir = (last_dir_info and last_dir_info.type == "dir") and last_dir or "."
local project_dir_explicit = false
local files = {}
local delayed_error