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
Changes from 1 commit
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
6 changes: 4 additions & 2 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 @@ -79,7 +81,7 @@ log.new = function(config, standalone)

local outfile = vim.F.if_nil(
config.outfile,
string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), config.plugin)
Path:new(Path:new(vim.api.nvim_call_function("stdpath", { "cache" })) / config.plugin).filename
delphinus marked this conversation as resolved.
Show resolved Hide resolved
)

local obj
Expand Down Expand Up @@ -159,7 +161,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