Skip to content

Commit

Permalink
fix(log): use robust way to create path (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
delphinus committed Sep 10, 2023
1 parent 62d1e2e commit 0232372
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lua/plenary/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.

local Path = require "plenary.path"

local p_debug = vim.fn.getenv "DEBUG_PLENARY"
if p_debug == vim.NIL then
p_debug = false
Expand Down Expand Up @@ -77,10 +79,8 @@ local unpack = unpack or table.unpack
log.new = function(config, standalone)
config = vim.tbl_deep_extend("force", default_config, config)

local outfile = vim.F.if_nil(
config.outfile,
string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), config.plugin)
)
local outfile =
vim.F.if_nil(config.outfile, Path:new(vim.api.nvim_call_function("stdpath", { "cache" }), config.plugin).filename)

local obj
if standalone then
Expand Down Expand Up @@ -159,7 +159,7 @@ log.new = function(config, standalone)

-- Output to log file
if config.use_file then
local outfile_parent_path = require("plenary.path"):new(outfile):parent()
local outfile_parent_path = Path:new(outfile):parent()
if not outfile_parent_path:exists() then
outfile_parent_path:mkdir { parents = true }
end
Expand Down
2 changes: 1 addition & 1 deletion lua/plenary/popup/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function popup.create(what, vim_options)
{ noremap = true }
)
end

if vim_options.finalize_callback then
vim_options.finalize_callback(win_id, bufnr)
end
Expand Down

0 comments on commit 0232372

Please sign in to comment.