created wea_core.path

This commit is contained in:
VorTechnix 2024-10-23 16:11:43 -07:00
parent 97e8bd1361
commit cbfd695d72
No known key found for this signature in database
GPG Key ID: 091E91A69545D5BA
3 changed files with 7 additions and 3 deletions

@ -4,7 +4,6 @@ local wea_c = worldeditadditions_core
wea_c.format = {
array_2d = dofile(wea_c.modpath.."/utils/format/array_2d.lua"),
escape = dofile(wea_c.modpath.."/utils/format/escape.lua"),
file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"),
human_size = dofile(wea_c.modpath.."/utils/format/human_size.lua"),
human_time = dofile(wea_c.modpath.."/utils/format/human_time.lua"),
make_ascii_table = dofile(wea_c.modpath.."/utils/format/make_ascii_table.lua"),

@ -0,0 +1,5 @@
local wea_c = worldeditadditions_core
wea_c.path = {
file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"),
}

@ -7,11 +7,11 @@ local wea_c = worldeditadditions_core
-- @return string The joined path.
-- @example Basic usage
-- local path = file_path("C:\\Users", "me", "/Documents/code.lua")
local file_path = function( ... )
local join = function( ... )
local path = { ... }
for i, v in ipairs(path) do path[i] = tostring(v) end
return ({table.concat(path, wea_c.dirsep)
:gsub("[/\\]+", wea_c.dirsep)})[1]
end
return file_path
return join