Skip to content

Commit

Permalink
fix(compiler): add file permission error (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenEast committed Sep 5, 2023
1 parent a48f6d9 commit e886e39
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lua/nightfox/lib/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,27 @@ vim.o.background = "%s"
local output_path, output_file = config.get_compiled_info(opts)
util.ensure_dir(output_path)

local file
local file, err
if vim.g.nightfox_debug then
file = io.open(output_file .. ".lua", "wb")
file:write(table.concat(lines, "\n"))
file:close()
end

file = io.open(output_file, "wb")
file, err = io.open(output_file, "wb")
if not file then
require("nightfox.lib.log").error(fmt(
[[Couldn't open %s: %s.
Check that %s is accessible for the current user.
You could try deleting %s to reset permissions]],
output_file,
err,
output_file,
output_path
))
return
end

local f = loadstring(table.concat(lines, "\n"), "=")
if not f then
Expand Down

0 comments on commit e886e39

Please sign in to comment.