diff options
author | Steven Barth <steven@midlink.org> | 2008-11-12 12:52:57 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-11-12 12:52:57 +0000 |
commit | 97130b6486e6e0f0c90c5937e97a075bf39c2519 (patch) | |
tree | 1f4b6b407f23110e092861a6bfde83a9f666ce2d /libs/core/luasrc | |
parent | f96de2586a80eb94060fbeef5d92703bd6db7a4b (diff) |
Make luci.fs.rename work across fielsystems
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r-- | libs/core/luasrc/fs.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/core/luasrc/fs.lua b/libs/core/luasrc/fs.lua index 276e04ec4f..abea5b5e80 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. |