Programist135

AssemblerForOpenOS

Sep 26th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. local windows = require("windows")
  2. local fs = require("filesystem")
  3.  
  4. local function check(filename)
  5.   if not fs.exists(filename) then
  6.     windows.universalWindow("auto", "auto", 30, 0xFFFFFF, true, {"EmptyLine"}, {"CenterText", 0x000000, "Пути \""..filename.."\" не существует!"}, {"EmptyLine"}, {"Button", {0xFF0000, 0xFFFFFF, "Выйти из программы"}})
  7.     os.exit()
  8.   end
  9. end
  10.  
  11. local function gatherData()
  12.   filePath = gatheredData[1]
  13.   check(filePath)
  14.   imgPath = gatheredData[2]
  15.   check(imgPath)
  16.   name = gatheredData[3]
  17. end
  18.  
  19. local function assemble()
  20.   local appName = "/"..name..".app"
  21.   fs.makeDirectory(appName)
  22.   fs.makeDirectory(appName.."/Resources/")
  23.   fs.copy(imgPath, appName.."/Resources/Icon.png")
  24.   fs.copy(filePath, appName.."/"..name..".lua")
  25.   local lnk = io.open("/System/OS/Desktop/"..name..".lnk", "w")
  26.   lnk:write("return \""..appName.."\"")
  27.   lnk:close()
  28. end
  29.  
  30. gatheredData = windows.universalWindow("auto", "auto", 30, 0xB7B7B7, true, {"EmptyLine"}, {"Input", 0x7B7B7B, 0x7B7B7B, "Путь к исходнику"}, {"Input", 0x7B7B7B, 0x7B7B7B, "Путь к картинке .png"}, {"Input", 0x7B7B7B, 0x7B7B7B, "Название программы"}, {"EmptyLine"}, {"Button", {0x00FF00, 0xFFFFFF, "Собрать!"}, {0xFF0000, 0xFFFFFF, "Отменить"}})
  31. gatherData()
  32. assemble()
  33. windows.universalWindow("auto", "auto", 30, 0xFFFFFF, true, {"EmptyLine"}, {"CenterText", 0x000000, "Сборка успешно завершена!"}, {"EmptyLine"}, {"Button", {0x00FF00, 0xFFFFFF, "Завершить!"}})
Advertisement
Add Comment
Please, Sign In to add comment