mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Merge branch 'openos-upgrade-merge' of https://github.com/payonel/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
c7f959d4ec
@ -59,16 +59,7 @@ local function areEqual(path1, path2)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local function isMount(path)
|
local function recurse(fromPath, toPath, origin)
|
||||||
path = fs.canonical(path)
|
|
||||||
for _, mountPath in fs.mounts() do
|
|
||||||
if path == fs.canonical(mountPath) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function recurse(fromPath, toPath)
|
|
||||||
status(fromPath, toPath)
|
status(fromPath, toPath)
|
||||||
if fs.isDirectory(fromPath) then
|
if fs.isDirectory(fromPath) then
|
||||||
if not options.r then
|
if not options.r then
|
||||||
@ -82,12 +73,12 @@ local function recurse(fromPath, toPath)
|
|||||||
-- my real cp always does this, even with -f, -n or -i.
|
-- my real cp always does this, even with -f, -n or -i.
|
||||||
return nil, "cannot overwrite non-directory `" .. toPath .. "' with directory `" .. fromPath .. "'"
|
return nil, "cannot overwrite non-directory `" .. toPath .. "' with directory `" .. fromPath .. "'"
|
||||||
end
|
end
|
||||||
if options.x and isMount(fromPath) then
|
fs.makeDirectory(toPath)
|
||||||
|
if options.x and origin and fs.get(fromPath) ~= origin then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
fs.makeDirectory(toPath)
|
|
||||||
for file in fs.list(fromPath) do
|
for file in fs.list(fromPath) do
|
||||||
local result, reason = recurse(fs.concat(fromPath, file), fs.concat(toPath, file))
|
local result, reason = recurse(fs.concat(fromPath, file), fs.concat(toPath, file), origin or fs.get(fromPath))
|
||||||
if not result then
|
if not result then
|
||||||
return nil, reason
|
return nil, reason
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
local sh = require('sh')
|
local sh = require('sh')
|
||||||
|
|
||||||
local clock_before = os.clock()
|
local clock_before = os.clock()
|
||||||
sh.execute(nil, ...)
|
local cmd_result = 0
|
||||||
local cmd_result = sh.getLastExitCode()
|
if ... then
|
||||||
|
sh.execute(nil, ...)
|
||||||
|
cmd_result = sh.getLastExitCode()
|
||||||
|
end
|
||||||
|
|
||||||
local clock_after = os.clock()
|
local clock_after = os.clock()
|
||||||
local clock_diff = clock_after - clock_before
|
local clock_diff = clock_after - clock_before
|
||||||
|
Loading…
x
Reference in New Issue
Block a user