diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 20:06:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 20:06:34 +0800 |
commit | 5b950742705515c4bc2502e8a902221f44bf644f (patch) | |
tree | f57ba3f1159eecfba3d882703b1b5775e0e72541 /script/fs-utility.lua | |
parent | deac4582d38908c1281d4d5215b7b69ff8400dca (diff) | |
download | lua-language-server-5b950742705515c4bc2502e8a902221f44bf644f.zip |
cleanup
Diffstat (limited to 'script/fs-utility.lua')
-rw-r--r-- | script/fs-utility.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/script/fs-utility.lua b/script/fs-utility.lua index db8d177c..3581bd50 100644 --- a/script/fs-utility.lua +++ b/script/fs-utility.lua @@ -261,7 +261,7 @@ end ---@param path string|fspath ---@param option table ----@return fspath +---@return fspath? local function fsAbsolute(path, option) if type(path) == 'string' then local suc, res = pcall(fs.path, path) @@ -451,6 +451,9 @@ local function fileRemove(path, option) end end +---@param source fspath? +---@param target fspath? +---@param option table local function fileCopy(source, target, option) if not source or not target then return @@ -462,7 +465,7 @@ local function fileCopy(source, target, option) if isDir2 or fsCreateDirectories(target, option) then for filePath in fsPairs(source) do local name = filePath:filename():string() - fileCopy(filePath, target / name, option) + fileCopy(filePath, target / name--[[@as fspath]], option) end end else @@ -513,7 +516,7 @@ local function fileSync(source, target, option) if fsCreateDirectories(target) then for filePath in fsPairs(source) do local name = filePath:filename():string() - fileCopy(filePath, target / name, option) + fileCopy(filePath, target / name--[[@as fspath]], option) end end end @@ -595,10 +598,10 @@ end ---@return table function m.fileCopy(source, target, option) option = buildOption(option) - source = fsAbsolute(source, option) - target = fsAbsolute(target, option) + local fsSource = fsAbsolute(source, option) + local fsTarget = fsAbsolute(target, option) - fileCopy(source, target, option) + fileCopy(fsSource, fsTarget, option) return option end @@ -609,10 +612,10 @@ end ---@return table function m.fileSync(source, target, option) option = buildOption(option) - source = fsAbsolute(source, option) - target = fsAbsolute(target, option) + local fsSource = fsAbsolute(source, option) + local fsTarget = fsAbsolute(target, option) - fileSync(source, target, option) + fileSync(fsSource, fsTarget, option) return option end |