Skip to content

Commit 2e8b846

Browse files
author
jghauser
committed
fix: remove remaining plenary.path function calls
1 parent 99aae36 commit 2e8b846

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lua/papis/fs-watcher.lua

+12-12
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ local function init_fs_watcher(dir_to_watch, is_library_root)
7878
if is_library_root then
7979
log.debug("Filesystem event in the library root directory")
8080
entry_dir = Path(dir_to_watch, filename)
81-
info_path = entry_dir:joinpath(info_name)
81+
info_path = entry_dir / info_name
8282
if entry_dir:exists() and entry_dir:is_dir() then
83-
log.debug(string.format("Filesystem event: path '%s' added", entry_dir:absolute()))
84-
init_fs_watcher(entry_dir:absolute())
83+
log.debug(string.format("Filesystem event: path '%s' added", tostring(entry_dir)))
84+
init_fs_watcher(tostring(entry_dir))
8585
if info_path:exists() then
86-
mtime = fs_stat(info_path:absolute()).mtime.sec
86+
mtime = fs_stat(tostring(info_path)).mtime.sec
8787
end
8888
elseif entry_dir:is_dir() then
89-
log.debug(string.format("Filesystem event: path '' removed", entry_dir:absolute()))
89+
log.debug(string.format("Filesystem event: path '' removed", tostring(entry_dir)))
9090
-- don't update here, because we'll catch it below under entry events
9191
do_update = false
9292
else
@@ -96,25 +96,25 @@ local function init_fs_watcher(dir_to_watch, is_library_root)
9696
else
9797
log.debug("Filesystem event in entry directory")
9898
entry_dir = Path(dir_to_watch)
99-
info_path = entry_dir:joinpath(info_name)
99+
info_path = entry_dir / info_name
100100
if info_path:exists() then
101101
-- info file exists, update with new info
102-
log.debug(string.format("Filesystem event: '%s' changed", info_path:absolute()))
103-
mtime = fs_stat(info_path:absolute()).mtime.sec
102+
log.debug(string.format("Filesystem event: '%s' changed", tostring(info_path)))
103+
mtime = fs_stat(tostring(info_path)).mtime.sec
104104
elseif not entry_dir:exists() then
105105
-- info file and entry dir don't exist. delete entry (mtime = nil) and remove watcher
106-
log.debug(string.format("Filesystem event: '%s' removed", info_path:absolute()))
106+
log.debug(string.format("Filesystem event: '%s' removed", tostring(info_path)))
107107
do_unwatch = true
108108
else
109109
-- info file doesn't exist but entry dir does. delete entry but keep watcher
110-
log.debug(string.format("Filesystem event: '%s' removed", info_path:absolute()))
110+
log.debug(string.format("Filesystem event: '%s' removed", tostring(info_path)))
111111
end
112112
end
113113
if do_update then
114114
log.debug("Update database for this fs event...")
115-
log.debug("Updating: " .. vim.inspect({ path = info_path:absolute(), mtime = mtime }))
115+
log.debug("Updating: " .. vim.inspect({ path = tostring(info_path), mtime = mtime }))
116116
vim.defer_fn(function()
117-
data.update_db({ path = info_path:absolute(), mtime = mtime })
117+
data.update_db({ path = tostring(info_path), mtime = mtime })
118118
end, 200)
119119
elseif do_unwatch then
120120
log.debug("Removing watcher")

lua/papis/utils.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function M:do_open_text_file(papis_id, type)
145145
log.debug("Opening a text file")
146146
local entry = db.data:get({ papis_id = papis_id }, { "notes", "id" })[1]
147147
local info_path = Path(db.metadata:get_value({ entry = entry["id"] }, "path"))
148-
log.debug("Text file in folder: " .. info_path:absolute())
148+
log.debug("Text file in folder: " .. tostring(info_path))
149149
local cmd = ""
150150
if type == "note" then
151151
log.debug("Opening a note")

0 commit comments

Comments
 (0)