From 84e094de362e4a428a290614b88c0a905a9f8b5f Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Thu, 4 May 2023 20:31:14 +0200 Subject: [PATCH] DataStorage: fix typo and actually create $HOME/.config if it doesn't exist yet (#10390) Fixes #10380. --- datastorage.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datastorage.lua b/datastorage.lua index 836cf51bc..42c73c5bd 100644 --- a/datastorage.lua +++ b/datastorage.lua @@ -24,18 +24,18 @@ function DataStorage:getDataDir() lfs.mkdir(os.getenv("XDG_CONFIG_HOME")) end else - local user_rw = jit.os == "OSX" and "Library/Application Support" or ".config" + local user_rw = string.format("%s/%s", os.getenv("HOME"), jit.os == "OSX" and "Library/Application Support" or ".config") if lfs.attributes(user_rw, "mode") ~= "directory" then lfs.mkdir(user_rw) end - data_dir = string.format("%s/%s/%s", os.getenv("HOME"), user_rw, "koreader") + data_dir = string.format("%s/%s", user_rw, "koreader") end else data_dir = "." end if lfs.attributes(data_dir, "mode") ~= "directory" then local ok, err = lfs.mkdir(data_dir) - if not ok then error(err) end + if not ok then error(err .. " " .. data_dir) end end return data_dir