Skip to content

Commit 0232372

Browse files
authored
fix(log): use robust way to create path (#521)
1 parent 62d1e2e commit 0232372

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lua/plenary/log.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
-- This library is free software; you can redistribute it and/or modify it
88
-- under the terms of the MIT license. See LICENSE for details.
99

10+
local Path = require "plenary.path"
11+
1012
local p_debug = vim.fn.getenv "DEBUG_PLENARY"
1113
if p_debug == vim.NIL then
1214
p_debug = false
@@ -77,10 +79,8 @@ local unpack = unpack or table.unpack
7779
log.new = function(config, standalone)
7880
config = vim.tbl_deep_extend("force", default_config, config)
7981

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

8585
local obj
8686
if standalone then
@@ -159,7 +159,7 @@ log.new = function(config, standalone)
159159

160160
-- Output to log file
161161
if config.use_file then
162-
local outfile_parent_path = require("plenary.path"):new(outfile):parent()
162+
local outfile_parent_path = Path:new(outfile):parent()
163163
if not outfile_parent_path:exists() then
164164
outfile_parent_path:mkdir { parents = true }
165165
end

lua/plenary/popup/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ function popup.create(what, vim_options)
426426
{ noremap = true }
427427
)
428428
end
429-
429+
430430
if vim_options.finalize_callback then
431431
vim_options.finalize_callback(win_id, bufnr)
432432
end

0 commit comments

Comments
 (0)