24 lines
492 B
Lua
24 lines
492 B
Lua
local Path = require "plenary.path"
|
|
local M = {}
|
|
|
|
M.iff = function(b, l, r)
|
|
if b then
|
|
return l
|
|
end
|
|
|
|
return r
|
|
end
|
|
|
|
M.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1
|
|
M.directory_sep = M.iff(M.is_windows, "\\\\", "/")
|
|
M.not_directory_sep = M.iff(M.is_windows, "/", "\\\\")
|
|
|
|
M.create_path = function(...)
|
|
return Path:new({...}):absolute():gsub(M.not_directory_sep, M.directory_sep):gsub(
|
|
M.directory_sep .. M.directory_sep,
|
|
M.directory_sep
|
|
)
|
|
end
|
|
|
|
return M
|