mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
dummix update
Former-commit-id: 6340be734589cc536b0dcbdb66580e274115e499 Former-commit-id: 7fc29796780a55f08905c4860f0759b81e4b695a
This commit is contained in:
4
src/net/torvald/terrarum/virtualcomputer/assets/loots/dummix/bin/cp.lua
Normal file → Executable file
4
src/net/torvald/terrarum/virtualcomputer/assets/loots/dummix/bin/cp.lua
Normal file → Executable file
@@ -1,2 +1,6 @@
|
||||
local args = {...}
|
||||
if (#args ~= 2) then
|
||||
print([[usage: cp source_file target_file
|
||||
cp source_file target_directory]])
|
||||
return end
|
||||
fs.cp(os.expandPath(args[1]), os.expandPath(args[2]))
|
||||
@@ -98,9 +98,11 @@ local function exec(tArgs)
|
||||
|
||||
-- do some sophisticated file-matching
|
||||
-- step 1: exact file
|
||||
if fs.isFile(fullFilePath) then shell.run(fullFilePath, execArgs)
|
||||
if fs.exists(fullFilePath) and fs.isFile(fullFilePath) then
|
||||
shell.run(fullFilePath, execArgs)
|
||||
-- step 2: try appending ".lua"
|
||||
elseif fs.isFile(fullFilePath..".lua") then shell.run(fullFilePath..".lua", execArgs)
|
||||
elseif fs.exists(fullFilePath..".lua") and fs.isFile(fullFilePath..".lua") then
|
||||
shell.run(fullFilePath..".lua", execArgs)
|
||||
-- step 3: parse os.path (just like $PATH)
|
||||
-- step 3.1: exact file; step 3.2: append ".lua"
|
||||
elseif not startsFromRoot(filePath) then
|
||||
@@ -110,11 +112,11 @@ local function exec(tArgs)
|
||||
|
||||
debug(path..filePath)
|
||||
|
||||
if fs.isFile(path..filePath) then
|
||||
if fs.exists(path..filePath) and fs.isFile(path..filePath) then
|
||||
execByPathArg = path..filePath
|
||||
execByPathFileExists = true
|
||||
break
|
||||
elseif fs.isFile(path..filePath..".lua") then
|
||||
elseif fs.exists(path..filePath..".lua") and fs.isFile(path..filePath..".lua") then
|
||||
execByPathArg = path..filePath..".lua"
|
||||
execByPathFileExists = true
|
||||
break
|
||||
|
||||
4
src/net/torvald/terrarum/virtualcomputer/assets/loots/dummix/bin/mv.lua
Normal file → Executable file
4
src/net/torvald/terrarum/virtualcomputer/assets/loots/dummix/bin/mv.lua
Normal file → Executable file
@@ -1,2 +1,6 @@
|
||||
local args = {...}
|
||||
if (#args ~= 2) then
|
||||
print([[usage: mv source target
|
||||
mv source ... directory]])
|
||||
return end
|
||||
fs.mv(os.expandPath(args[1]), os.expandPath(args[2]))
|
||||
Reference in New Issue
Block a user