mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 19:56:17 -04:00
fixing cp -x
This commit is contained in:
parent
54de3fe89d
commit
d9bd0096be
@ -59,6 +59,11 @@ local function areEqual(path1, path2)
|
||||
return result
|
||||
end
|
||||
|
||||
local mounts = {}
|
||||
for dev,path in fs.mounts() do
|
||||
mounts[fs.canonical(path)] = dev
|
||||
end
|
||||
|
||||
local function recurse(fromPath, toPath, origin)
|
||||
status(fromPath, toPath)
|
||||
if fs.isDirectory(fromPath) then
|
||||
@ -70,7 +75,7 @@ local function recurse(fromPath, toPath, origin)
|
||||
-- my real cp always does this, even with -f, -n or -i.
|
||||
return nil, "cannot overwrite non-directory `" .. toPath .. "' with directory `" .. fromPath .. "'"
|
||||
end
|
||||
if options.x and origin and fs.get(fromPath) ~= origin then
|
||||
if options.x and origin and mounts[fs.canonical(fromPath)] then
|
||||
return true
|
||||
end
|
||||
if fs.get(fromPath) == fs.get(toPath) and fs.canonical(fs.path(toPath)):find(fs.canonical(fromPath),1,true) then
|
||||
|
@ -60,7 +60,7 @@ io.write("Installing " .. name .." to device " .. (choice.getLabel() or choice.a
|
||||
os.sleep(0.25)
|
||||
local cpPath = filesystem.concat(findMount(filesystem.get(os.getenv("_")).address), "bin/cp")
|
||||
local cpOptions = "-vrx" .. (options.u and "ui " or "")
|
||||
local cpSource = filesystem.concat(findMount(fromAddress), options.fromDir or "/", "*")
|
||||
local cpSource = filesystem.concat(findMount(fromAddress), options.fromDir or "/")
|
||||
local cpDest = findMount(choice.address) .. "/"
|
||||
local result, reason = os.execute(cpPath .. " " .. cpOptions .. " " .. cpSource .. " " .. cpDest)
|
||||
if not result then
|
||||
|
Loading…
x
Reference in New Issue
Block a user