You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
543 B
23 lines
543 B
local plen_status_ok, _ = pcall(require, "plenary")
|
|
if not plen_status_ok then return end
|
|
|
|
local M = {}
|
|
local Path = require "plenary.path"
|
|
|
|
function M.get_path(str) return str:match "(.*[/\\])" end
|
|
|
|
function M.add_trailing_slash(value)
|
|
if value:sub(-1) ~= Path.path.sep then return value .. Path.path.sep end
|
|
return value
|
|
end
|
|
|
|
function M.split(inputstr, sep)
|
|
if sep == nil then sep = Path.path.sep end
|
|
local t = {}
|
|
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
|
|
table.insert(t, str)
|
|
end
|
|
return t
|
|
end
|
|
|
|
return M
|
|
|