From cbfd695d724359bde3b0846570b7295735c2db95 Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:11:43 -0700 Subject: [PATCH] created wea_core.path --- worldeditadditions_core/utils/format/init.lua | 1 - worldeditadditions_core/utils/path/init.lua | 5 +++++ .../utils/{format/file_path.lua => path/join.lua} | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 worldeditadditions_core/utils/path/init.lua rename worldeditadditions_core/utils/{format/file_path.lua => path/join.lua} (90%) diff --git a/worldeditadditions_core/utils/format/init.lua b/worldeditadditions_core/utils/format/init.lua index f4b1e8e..dc75fe3 100644 --- a/worldeditadditions_core/utils/format/init.lua +++ b/worldeditadditions_core/utils/format/init.lua @@ -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"), diff --git a/worldeditadditions_core/utils/path/init.lua b/worldeditadditions_core/utils/path/init.lua new file mode 100644 index 0000000..c6fb880 --- /dev/null +++ b/worldeditadditions_core/utils/path/init.lua @@ -0,0 +1,5 @@ +local wea_c = worldeditadditions_core + +wea_c.path = { + file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"), +} diff --git a/worldeditadditions_core/utils/format/file_path.lua b/worldeditadditions_core/utils/path/join.lua similarity index 90% rename from worldeditadditions_core/utils/format/file_path.lua rename to worldeditadditions_core/utils/path/join.lua index 751ed49..6ea8148 100644 --- a/worldeditadditions_core/utils/format/file_path.lua +++ b/worldeditadditions_core/utils/path/join.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 \ No newline at end of file +return join \ No newline at end of file