add file.parent(...)

This commit is contained in:
MihailRis 2025-03-10 23:01:34 +03:00
parent 567105dfce
commit c6492b3d25

View File

@ -543,3 +543,11 @@ end
function file.prefix(path) function file.prefix(path)
return path:match("^([^:]+)") return path:match("^([^:]+)")
end end
function file.parent(path)
local pos = path:find("/")
if not pos then
return file.prefix(path)..":"
end
return path:sub(0, pos-1)
end