aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/nvim/lua/crupest/system/fs.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/configs/nvim/lua/crupest/system/fs.lua b/configs/nvim/lua/crupest/system/fs.lua
index c879239..2f489c3 100644
--- a/configs/nvim/lua/crupest/system/fs.lua
+++ b/configs/nvim/lua/crupest/system/fs.lua
@@ -1,21 +1,22 @@
local function clean_path(path)
- return path and (string.gsub(path, "[/\\]+", "/"))
-end
-
-local function full_path(name)
- local path = vim.fn.fnamemodify(name, ":p:gs?\\?/?")
+ path = string.gsub(path, "[/\\]+", "/")
if string.sub(path, string.len(path)) == '/' then
path = string.sub(path, 1, string.len(path) - 1)
end
return path
end
+local function full_path(name)
+ local path = vim.fn.fnamemodify(name, ":p")
+ return clean_path(path)
+end
+
local function escape_space(str)
return (string.gsub(str, " ", "\\ "))
end
local function path_get_dir(path)
- return vim.fn.fnamemodify(full_path(path), ":h")
+ return full_path(vim.fn.fnamemodify(clean_path(path), ":h"))
end
local function walk_up(path, func)