Advertisement
HangMan23

MkDir.lua

Jan 22nd, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local EU = require("ExtraUtilits")
  2. if EU.version < 1.0 then error("Invalid version of ExtraUtilits library. Install version 1.0 or more to use it.") end
  3. local fs = require("filesystem")
  4. local shell = require("shell")
  5. local gpu = require("component").gpu
  6. local unicode = require("unicode")
  7.  
  8. path = shell.resolve("")
  9.  
  10. s = false
  11.  
  12. repeat
  13.   lpath = path .. "/" .. EU.ReadyUtilits.WriteFieldUI(60, 23, "Enter folder name")
  14.  
  15.   local function foo()  
  16.  
  17.   if fs.exists(lpath) then
  18.  
  19.       local text = "Folder with name '" .. lpath .. "' is already exists."
  20.       gpu.setBackground(0xff0000)
  21.       gpu.setForeground(0xffffff)
  22.       gpu.fill(80 - unicode.wlen(text) / 2, 23, unicode.wlen(text) + 2, 3, " ")
  23.       gpu.set(80 - unicode.wlen(text) / 2 + 1, 24, text)
  24.       os.sleep(2)
  25.     else
  26.       s = true
  27.     end
  28.  
  29.   end
  30.  
  31.   EU.screenBackup(foo)
  32. until s
  33.  
  34. path = lpath
  35.  
  36. local result, reason = fs.makeDirectory(path)
  37.  
  38. if not result then print(reason) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement