Advertisement
joebodo

apps.ln.lua

Oct 26th, 2016
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. if #args ~= 2 then
  4.     error('Syntax: ls <source> <target>')
  5. end
  6.  
  7. local source = shell.resolve(args[1])
  8. local target = shell.resolve(args[2])
  9.  
  10. if not fs.isDir(source) then
  11.     error('Source must be a directory')
  12. end
  13.  
  14. if fs.isDir(target) then
  15.     target = fs.combine(target, fs.getName(source))
  16. end
  17.  
  18. if fs.exists(target) then
  19.     error('Target already exists')
  20. end
  21.  
  22. fs.link(source, target)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement