From: Steven Barth Date: Wed, 12 Nov 2008 12:53:20 +0000 (+0000) Subject: Make luci.fs.rename work across fielsystems X-Git-Tag: 0.8.2~36 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4114169f2cc52b300a55144892375804dc564b64;p=oweals%2Fluci.git Make luci.fs.rename work across fielsystems --- diff --git a/libs/core/luasrc/fs.lua b/libs/core/luasrc/fs.lua index 276e04ec4..abea5b5e8 100644 --- a/libs/core/luasrc/fs.lua +++ b/libs/core/luasrc/fs.lua @@ -110,7 +110,14 @@ end -- @param dest Destination -- @return Boolean containing true on success or nil on error function rename(source, dest) - return os.rename(source, dest) + local stat, err, code = os.rename(source, dest) + if code == 18 then + stat, err, code = copy(source, dest) + if stat then + stat, err, code = unlink(source) + end + end + return stat, err, code end --- Get the last modification time of given file path in Unix epoch format.