From d7e5a80c97e2a52de1baf63818040128bbb4c121 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Sat, 9 Sep 2023 20:43:07 +0200 Subject: Don't create user `init.lua` if no custom config was specified --- src/lpm.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/lpm.lua') diff --git a/src/lpm.lua b/src/lpm.lua index e502860..c692b0c 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1314,14 +1314,16 @@ function Bottle:construct() common.rmrf(self.local_path) if not self.lite_xl:is_installed() then self.lite_xl:install() end common.mkdirp(self.local_path .. PATHSEP .. "user") - io.open(self.local_path .. PATHSEP .. "user" .. PATHSEP .. "init.lua", "wb"):write([[ - local core = require "core" - local command = require "core.command" - local keymap = require "core.keymap" - local config = require "core.config" - local style = require "core.style" - ]] .. self.config - ):close() + if self.config then + io.open(self.local_path .. PATHSEP .. "user" .. PATHSEP .. "init.lua", "wb"):write([[ + local core = require "core" + local command = require "core.command" + local keymap = require "core.keymap" + local config = require "core.config" + local style = require "core.style" + ]] .. self.config + ):close() + end -- Always copy the executbale, because of the way that lite determines the user folder (for now). common.copy(self.lite_xl:get_binary_path(), self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION) -- cgit v1.2.3