Skip to content

Commit

Permalink
created wea_core.path
Browse files Browse the repository at this point in the history
  • Loading branch information
VorTechnix committed Oct 23, 2024
1 parent 97e8bd1 commit cbfd695
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion worldeditadditions_core/utils/format/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
5 changes: 5 additions & 0 deletions worldeditadditions_core/utils/path/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local wea_c = worldeditadditions_core

wea_c.path = {
file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cbfd695

Please sign in to comment.