Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use robust way to create path #521

Merged
merged 4 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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