Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createLink(path, name)
- local linkFile
- if not path then
- iox.colorPrint("No path given", colors.red)
- return
- end
- if fs.isDir(path) then
- iox.colorPrint(path.." is a directory, give path to a program file", colors.red)
- return
- end
- if not name then
- name = fs.getName(path)
- end
- if fs.exists("/"..name) then
- iox.colorPrint("File exists: /"..name..", override or cancel? {o|c}", colors.orange)
- local input
- while true do
- input = read()
- if input == "o" then
- fs.delete("/"..name)
- break
- elseif input == "c" then
- return
- else
- iox.colorPrint("Invalid input, 'o' or 'c'", colors.red)
- end
- end
- end
- linkFile = fs.open(name, "w")
- linkFile.write("shell.run(\""..path.."\", \"{...}\")")
- linkFile.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment