diff --git a/MineOS/About/English.txt b/About/English.txt similarity index 100% rename from MineOS/About/English.txt rename to About/English.txt diff --git a/MineOS/About/Russian.txt b/About/Russian.txt similarity index 100% rename from MineOS/About/Russian.txt rename to About/Russian.txt diff --git a/Applications.cfg b/Applications.cfg index 0fbdb672..37f26e34 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -1,218 +1,218 @@ { { path="/OS.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/OS.lua", - about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/About/", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/OS.lua", + about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/About/", type="Script", forceDownload=true, - version=3.88, + version=3.89, }, { path="/MineOS/Pictures/MoonTouch.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/MoonTouch.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/MoonTouch.pic", type="Wallpaper", version=1.0, }, { path="/MineOS/Pictures/Raspberry.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Raspberry.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Raspberry.pic", type="Wallpaper", version=1.0, }, { path="/MineOS/Pictures/Catniss.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Catniss.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Catniss.pic", type="Wallpaper", version=1.01, }, { path="/MineOS/Pictures/Ciri.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Ciri.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Ciri.pic", type="Wallpaper", version=1.01, }, { path="/MineOS/Pictures/Girl.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Girl.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Girl.pic", type="Wallpaper", version=1.01, }, { path="/MineOS/Pictures/Space.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Space.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Space.pic", type="Wallpaper", version=1.0, }, { path="/MineOS/Pictures/Block.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Block.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Block.pic", type="Wallpaper", version=1.0, }, { path="/MineOS/Pictures/Road.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Road.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Road.pic", type="Wallpaper", version=1.0, }, { path="/MineOS/System/Localization/Russian.lang", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Localization/Russian.lang", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localization/Russian.lang", type="Script", forceDownload=true, version=1.32, }, { path="/MineOS/System/Localization/English.lang", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Localization/English.lang", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localization/English.lang", type="Script", forceDownload=true, version=1.32, }, ----------------------------------------------------- Ассоциация говна -------------------------------------------------------------------------- { - path="/MineOS/System/ExtensionAssociations/Lua/ContextMenu.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Lua/ContextMenu.lua", + path="/MineOS/System/Extensions/Lua/ContextMenu.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/ContextMenu.lua", type="Script", forceDownload=true, - version=1.02, + version=1.03, }, { - path="/MineOS/System/ExtensionAssociations/Lua/Launcher.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Lua/Launcher.lua", + path="/MineOS/System/Extensions/Lua/Launcher.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/Launcher.lua", type="Script", forceDownload=true, - version=1.02, + version=1.03, }, -- { - path="/MineOS/System/ExtensionAssociations/Pic/ContextMenu.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Pic/ContextMenu.lua", + path="/MineOS/System/Extensions/Pic/ContextMenu.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Pic/ContextMenu.lua", type="Script", forceDownload=true, - version=1.02, + version=1.03, }, -- { - path="/MineOS/System/ExtensionAssociations/Pkg/Launcher.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Pkg/Launcher.lua", + path="/MineOS/System/Extensions/Pkg/Launcher.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Pkg/Launcher.lua", type="Script", forceDownload=true, - version=1.02, + version=1.03, }, ----------------------------------------------------- Системные иконки -------------------------------------------------------------------------- { path="/MineOS/System/Icons/Application.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Application.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Application.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/3DModel.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/3DModel.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/3DModel.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Computer.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Computer.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Computer.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Robot.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Robot.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Robot.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Tablet.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Tablet.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Tablet.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Pastebin.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Pastebin.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Pastebin.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/HDD.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/HDD.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/HDD.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Floppy.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Floppy.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Floppy.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Steve.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Steve.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Steve.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Folder.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Folder.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Folder.pic", type="Icon", version=1.01, }, { path="/MineOS/System/Icons/FileNotExists.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/FileNotExists.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/FileNotExists.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Script.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Script.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Script.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Text.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Text.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Text.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Config.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Config.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Config.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Image.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Image.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Image.pic", type="Icon", version=1.01, }, { path="/MineOS/System/Icons/Lua.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Lua.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Lua.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/SampleIcon.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/SampleIcon.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/SampleIcon.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Archive.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Archive.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Archive.pic", type="Icon", version=1.0, }, { path="/MineOS/System/Icons/Trash.pic", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Trash.pic", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Trash.pic", type="Icon", version=1.01, }, @@ -223,25 +223,27 @@ path="/lib/MineOSCore.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua", type="Library", - version=1.88, + preloadFile=true, + version=1.89, }, { path="/lib/MineOSNetwork.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSNetwork.lua", type="Library", - version=1.03, + version=1.04, }, { path="/lib/MineOSInterface.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSInterface.lua", type="Library", - version=1.01, + version=1.02, }, { path="/lib/MineOSPaths.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSPaths.lua", type="Library", - version=1.00, + preloadFile=true, + version=1.01, }, { path="/lib/advancedLua.lua", @@ -421,28 +423,28 @@ ----------------------------------------------------- Screensavers -------------------------------------------------------------------------- { path="/MineOS/System/Screensavers/Matrix.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Matrix.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Matrix.lua", type="Script", forceDownload=true, version=1.02, }, { path="/MineOS/System/Screensavers/Mandala.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Mandala.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Mandala.lua", type="Script", forceDownload=true, version=1.00, }, { path="/MineOS/System/Screensavers/Clock.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Clock.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Clock.lua", type="Script", forceDownload=true, version=1.00, }, { path="/MineOS/System/Screensavers/Lines.lua", - url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Lines.lua", + url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Lines.lua", type="Script", forceDownload=true, version=1.00, diff --git a/MineOS/MineOSPacker/MineOS.pkg b/Applications/MineOSPacker/MineOS.pkg similarity index 100% rename from MineOS/MineOSPacker/MineOS.pkg rename to Applications/MineOSPacker/MineOS.pkg diff --git a/MineOS/MineOSPacker/MineOSPacker.lua b/Applications/MineOSPacker/MineOSPacker.lua similarity index 100% rename from MineOS/MineOSPacker/MineOSPacker.lua rename to Applications/MineOSPacker/MineOSPacker.lua diff --git a/MineOS/EFI.lua b/EFI.lua similarity index 100% rename from MineOS/EFI.lua rename to EFI.lua diff --git a/MineOS/ExtensionAssociations/Lua/ContextMenu.lua b/Extensions/Lua/ContextMenu.lua similarity index 100% rename from MineOS/ExtensionAssociations/Lua/ContextMenu.lua rename to Extensions/Lua/ContextMenu.lua diff --git a/MineOS/ExtensionAssociations/Lua/Launcher.lua b/Extensions/Lua/Launcher.lua similarity index 100% rename from MineOS/ExtensionAssociations/Lua/Launcher.lua rename to Extensions/Lua/Launcher.lua diff --git a/MineOS/ExtensionAssociations/Pic/ContextMenu.lua b/Extensions/Pic/ContextMenu.lua similarity index 100% rename from MineOS/ExtensionAssociations/Pic/ContextMenu.lua rename to Extensions/Pic/ContextMenu.lua diff --git a/MineOS/ExtensionAssociations/Pkg/Launcher.lua b/Extensions/Pkg/Launcher.lua similarity index 100% rename from MineOS/ExtensionAssociations/Pkg/Launcher.lua rename to Extensions/Pkg/Launcher.lua diff --git a/MineOS/Icons/3DModel.pic b/Icons/3DModel.pic similarity index 100% rename from MineOS/Icons/3DModel.pic rename to Icons/3DModel.pic diff --git a/MineOS/Icons/Application.pic b/Icons/Application.pic similarity index 100% rename from MineOS/Icons/Application.pic rename to Icons/Application.pic diff --git a/MineOS/Icons/Archive.pic b/Icons/Archive.pic similarity index 100% rename from MineOS/Icons/Archive.pic rename to Icons/Archive.pic diff --git a/MineOS/Icons/Computer.pic b/Icons/Computer.pic similarity index 100% rename from MineOS/Icons/Computer.pic rename to Icons/Computer.pic diff --git a/MineOS/Icons/Config.pic b/Icons/Config.pic similarity index 100% rename from MineOS/Icons/Config.pic rename to Icons/Config.pic diff --git a/MineOS/Icons/Downloading.pic b/Icons/Downloading.pic similarity index 100% rename from MineOS/Icons/Downloading.pic rename to Icons/Downloading.pic diff --git a/MineOS/Icons/FileNotExists.pic b/Icons/FileNotExists.pic similarity index 100% rename from MineOS/Icons/FileNotExists.pic rename to Icons/FileNotExists.pic diff --git a/MineOS/Icons/Finger.pic b/Icons/Finger.pic similarity index 100% rename from MineOS/Icons/Finger.pic rename to Icons/Finger.pic diff --git a/MineOS/Icons/Floppy.pic b/Icons/Floppy.pic similarity index 100% rename from MineOS/Icons/Floppy.pic rename to Icons/Floppy.pic diff --git a/MineOS/Icons/Folder.pic b/Icons/Folder.pic similarity index 100% rename from MineOS/Icons/Folder.pic rename to Icons/Folder.pic diff --git a/MineOS/Icons/HDD.pic b/Icons/HDD.pic similarity index 100% rename from MineOS/Icons/HDD.pic rename to Icons/HDD.pic diff --git a/MineOS/Icons/Image.pic b/Icons/Image.pic similarity index 100% rename from MineOS/Icons/Image.pic rename to Icons/Image.pic diff --git a/MineOS/Icons/Languages.pic b/Icons/Languages.pic similarity index 100% rename from MineOS/Icons/Languages.pic rename to Icons/Languages.pic diff --git a/MineOS/Icons/Love.pic b/Icons/Love.pic similarity index 100% rename from MineOS/Icons/Love.pic rename to Icons/Love.pic diff --git a/MineOS/Icons/Lua.pic b/Icons/Lua.pic similarity index 100% rename from MineOS/Icons/Lua.pic rename to Icons/Lua.pic diff --git a/MineOS/Icons/OK.pic b/Icons/OK.pic similarity index 100% rename from MineOS/Icons/OK.pic rename to Icons/OK.pic diff --git a/MineOS/Icons/OS_Logo.pic b/Icons/OS_Logo.pic similarity index 100% rename from MineOS/Icons/OS_Logo.pic rename to Icons/OS_Logo.pic diff --git a/MineOS/Icons/Pastebin.pic b/Icons/Pastebin.pic similarity index 100% rename from MineOS/Icons/Pastebin.pic rename to Icons/Pastebin.pic diff --git a/MineOS/Icons/Robot.pic b/Icons/Robot.pic similarity index 100% rename from MineOS/Icons/Robot.pic rename to Icons/Robot.pic diff --git a/MineOS/Icons/SampleIcon.pic b/Icons/SampleIcon.pic similarity index 100% rename from MineOS/Icons/SampleIcon.pic rename to Icons/SampleIcon.pic diff --git a/MineOS/Icons/Script.pic b/Icons/Script.pic similarity index 100% rename from MineOS/Icons/Script.pic rename to Icons/Script.pic diff --git a/MineOS/Icons/Security.pic b/Icons/Security.pic similarity index 100% rename from MineOS/Icons/Security.pic rename to Icons/Security.pic diff --git a/MineOS/Icons/Steve.pic b/Icons/Steve.pic similarity index 100% rename from MineOS/Icons/Steve.pic rename to Icons/Steve.pic diff --git a/MineOS/Icons/Tablet.pic b/Icons/Tablet.pic similarity index 100% rename from MineOS/Icons/Tablet.pic rename to Icons/Tablet.pic diff --git a/MineOS/Icons/Text.pic b/Icons/Text.pic similarity index 100% rename from MineOS/Icons/Text.pic rename to Icons/Text.pic diff --git a/MineOS/Icons/Trash.pic b/Icons/Trash.pic similarity index 100% rename from MineOS/Icons/Trash.pic rename to Icons/Trash.pic diff --git a/MineOS/Icons/Update.pic b/Icons/Update.pic similarity index 100% rename from MineOS/Icons/Update.pic rename to Icons/Update.pic diff --git a/Installer/Installer.lua b/Installer/Installer.lua index 3017a1ac..30b73a04 100644 --- a/Installer/Installer.lua +++ b/Installer/Installer.lua @@ -12,6 +12,19 @@ local args, options = shell.parse(...) ------------------------------------------------------------------------------------------------------------------------------------ +local paths = { + applicationList = "/MineOS/System/Applications.cfg", +} + +local URLs = { + applicationList = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications.cfg", + installer = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Installer/", + EFI = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/EFI.lua", + license = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/License/", +} + +------------------------------------------------------------------------------------------------------------------------------------ + local reasons = {} if not _G._OSVERSION or tonumber(_G._OSVERSION:sub(8, 10)) < 1.5 then @@ -46,19 +59,6 @@ end ------------------------------------------------------------------------------------------------------------------------------------ -local paths = { - applicationList = "/MineOS/System/Applications.cfg", - OSSettings = "/MineOS/System/Properties.cfg", -} - -local urls = { - applicationList = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications.cfg", - installer = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Installer/", - EFI = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/EFI.lua", -} - ------------------------------------------------------------------------------------------------------------------------------------- - local function unserializeFile(path) local file = io.open(path, "r") local data = serialization.unserialize(file:read("*a")) @@ -68,11 +68,11 @@ end local function wget(url, path) fs.makeDirectory(fs.path(path)) - shell.execute("wget " ..url .. " " .. path .. " -fq") + shell.execute("wget " .. url .. " " .. path .. " -fq") end print("Downloading MineOS file list...") -wget(urls.applicationList, paths.applicationList) +wget(URLs.applicationList, paths.applicationList) applicationList = unserializeFile(paths.applicationList) print(" ") @@ -107,6 +107,8 @@ end local web = require("web") local buffer = require("doubleBuffering") local GUI = require("GUI") +local MineOSPaths = require("MineOSPaths") +local MineOSCore = require("MineOSCore") buffer.setResolution(gpu.maxResolution()) local mainContainer = GUI.fullScreenContainer() @@ -117,7 +119,6 @@ stageContainer:addChild(GUI.panel(1, 1, stageContainer.width, stageContainer.hei ------------------------------------------------------------------------------------------------------------------------------------ -local OSSettings = {} local stages = {current = 1} local localization @@ -167,8 +168,8 @@ end ------------------------------------------------------------------------------------------------------------------------------------ local function loadLocalization(language) - OSSettings.language = language - localization = serialization.unserialize(web.request(urls.installer .. OSSettings.language .. ".lang")) + MineOSCore.properties.language = language + localization = serialization.unserialize(web.request(URLs.installer .. MineOSCore.properties.language .. ".lang")) end stages[1] = function() @@ -212,7 +213,7 @@ end stages[3] = function() addButtonsToStage() - local data = web.request("https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/License/" .. OSSettings.language .. ".lang") + local data = web.request(URLs.license .. MineOSCore.properties.language .. ".lang") local lines = {} for line in data:gmatch("[^\n]+") do table.insert(lines, line) @@ -243,7 +244,7 @@ stages[4] = function() local thingsToDownload = {} for i = 1, #applicationList do if - not applicationList[i].preLoadFile and + not applicationList[i].preloadFile and ( (applicationList[i].type == "Library" or applicationList[i].type == "Icon") or @@ -269,7 +270,7 @@ stages[4] = function() mainContainer:draw() buffer.draw() - web.downloadMineOSApplication(thingsToDownload[i], OSSettings.language) + web.downloadMineOSApplication(thingsToDownload[i], MineOSCore.properties.language) end stageContainer:deleteChildren(2) @@ -278,7 +279,7 @@ stages[4] = function() mainContainer:draw() buffer.draw() - component.eeprom.set(web.request(urls.EFI)) + component.eeprom.set(web.request(URLs.EFI)) stages.load(5) end @@ -291,31 +292,9 @@ stages[5] = function() stageContainer:addChild(GUI.label(1, 22, stageContainer.width, 1, 0x666666, localization.needToReboot)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top) stageContainer:addChild(GUI.adaptiveRoundedButton(math.floor(stageContainer.width / 2 - (unicode.len(localization.reboot) + 4) / 2), stageContainer.height - 4, 2, 1, 0xAAAAAA, 0xDDDDDD, 0x777777, 0xDDDDDD, localization.reboot)).onTouch = function() - fs.makeDirectory("/MineOS/Pictures/") - fs.makeDirectory("/MineOS/Application data/") - fs.makeDirectory("/MineOS/Trash/") - - OSSettings.wallpaper = stageContainer.downloadWallpapersSwitch.state and "/MineOS/Pictures/Road.pic" or nil - OSSettings.wallpaperEnabled = true - OSSettings.transparencyEnabled = true - OSSettings.showApplicationIcons = true - OSSettings.screensaver = "Matrix" - OSSettings.screensaverDelay = 20 - OSSettings.showHelpOnApplicationStart = stageContainer.showApplicationsHelpSwitch.state - OSSettings.dockShortcuts = { - "/MineOS/Applications/AppMarket.app/", - "/MineOS/Applications/MineCode IDE.app/", - "/MineOS/Applications/Finder.app/", - "/MineOS/Applications/Photoshop.app/", - } - OSSettings.backgroundColor = 0x1E1E1E - OSSettings.network = { - users = {}, - enabled = true, - signalStrength = 512, - } - - table.toFile(paths.OSSettings, OSSettings) + MineOSCore.properties.wallpaper = stageContainer.downloadWallpapersSwitch.state and MineOSPaths.pictures .. "Road.pic" or nil + MineOSCore.properties.showHelpOnApplicationStart = stageContainer.showApplicationsHelpSwitch.state + MineOSCore.saveProperties() local file = io.open("/autorun.lua", "w") file:write("dofile(\"/OS.lua\")") diff --git a/MineOS/License/English.lang b/License/English.lang similarity index 100% rename from MineOS/License/English.lang rename to License/English.lang diff --git a/MineOS/License/Russian.lang b/License/Russian.lang similarity index 100% rename from MineOS/License/Russian.lang rename to License/Russian.lang diff --git a/MineOS/Localization/English.lang b/Localization/English.lang similarity index 100% rename from MineOS/Localization/English.lang rename to Localization/English.lang diff --git a/MineOS/Localization/Russian.lang b/Localization/Russian.lang similarity index 100% rename from MineOS/Localization/Russian.lang rename to Localization/Russian.lang diff --git a/MineOS/Init.lua b/MineOS/Init.lua deleted file mode 100755 index 4c80f448..00000000 --- a/MineOS/Init.lua +++ /dev/null @@ -1,200 +0,0 @@ -local background, foreground, logoColor = 0xDDDDDD, 0x999999, 0x444444 - -do - _G._OSVERSION = "OpenOS 1.6" - - local component = component - local computer = computer - local unicode = unicode - - -- Runlevel information. - local runlevel, shutdown = "S", computer.shutdown - computer.runlevel = function() return runlevel end - computer.shutdown = function(reboot) - runlevel = reboot and 6 or 0 - if os.sleep then - computer.pushSignal("shutdown") - os.sleep(0.1) -- Allow shutdown processing. - end - shutdown(reboot) - end - - -- Low level dofile implementation to read filesystem libraries. - local rom = {} - function rom.invoke(method, ...) - return component.invoke(computer.getBootAddress(), method, ...) - end - function rom.open(file) return rom.invoke("open", file) end - function rom.read(handle) return rom.invoke("read", handle, math.huge) end - function rom.close(handle) return rom.invoke("close", handle) end - function rom.inits() return ipairs(rom.invoke("list", "boot")) end - function rom.isDirectory(path) return rom.invoke("isDirectory", path) end - - local screen = component.list('screen', true)() - for address in component.list('screen', true) do - if #component.invoke(address, 'getKeyboards') > 0 then - screen = address - end - end - - -- Report boot progress if possible. - local gpu = component.list("gpu", true)() - local w, h - if gpu and screen then - component.invoke(gpu, "bind", screen) - w, h = component.invoke(gpu, "maxResolution") - component.invoke(gpu, "setResolution", w, h) - component.invoke(gpu, "setBackground", background) - component.invoke(gpu, "setForeground", foreground) - component.invoke(gpu, "fill", 1, 1, w, h, " ") - end - - local function centerText(y, text, color) - if gpu and screen then - local msgWidth = unicode.len(text) - local x = math.floor(w / 2 - msgWidth / 2) - component.invoke(gpu, "fill", 1, y, w, 1, " ") - component.invoke(gpu, "setForeground", color) - component.invoke(gpu, "set", x, y, text) - end - end - - local y = math.floor(h / 2 - 1) - - local function status(text) - centerText(y, "MineOS", logoColor) - centerText(y + 1, text, foreground) - end - - status("Booting " .. _OSVERSION .. "...") - - -- Custom low-level loadfile/dofile implementation reading from our ROM. - local function loadfile(file) - status("Loading " .. file) - local handle, reason = rom.open(file) - if not handle then - error(reason) - end - local buffer = "" - repeat - local data, reason = rom.read(handle) - if not data and reason then - error(reason) - end - buffer = buffer .. (data or "") - until not data - rom.close(handle) - return load(buffer, "=" .. file) - end - - local function dofile(file) - local program, reason = loadfile(file) - if program then - local result = table.pack(pcall(program)) - if result[1] then - return table.unpack(result, 2, result.n) - else - error(result[2]) - end - else - error(reason) - end - end - - status("Initializing package management") - - -- Load file system related libraries we need to load other stuff moree - -- comfortably. This is basically wrapper stuff for the file streams - -- provided by the filesystem components. - local package = dofile("/lib/package.lua") - - do - -- Unclutter global namespace now that we have the package module. - _G.component = nil - _G.computer = nil - _G.process = nil - _G.unicode = nil - - -- Initialize the package module with some of our own APIs. - package.loaded.component = component - package.loaded.computer = computer - package.loaded.unicode = unicode - package.preload["buffer"] = loadfile("/lib/buffer.lua") - package.preload["filesystem"] = loadfile("/lib/filesystem.lua") - - -- Inject the package and io modules into the global namespace, as in Lua. - _G.package = package - _G.io = loadfile("/lib/io.lua")() - - --mark modules for delay loaded api - -- package.delayed["text"] = true - -- package.delayed["sh"] = true - -- package.delayed["transforms"] = true - -- package.delayed["term"] = true - end - - status("Initializing file system") - - -- Mount the ROM and temporary file systems to allow working on the file - -- system module from this point on. - require("filesystem").mount(computer.getBootAddress(), "/") - package.preload={} - - status("Running boot scripts") - - -- Run library startup scripts. These mostly initialize event handlers. - local scripts = {} - for _, file in rom.inits() do - local path = "boot/" .. file - if not rom.isDirectory(path) then - table.insert(scripts, path) - end - end - table.sort(scripts) - for i = 1, #scripts do - dofile(scripts[i]) - end - - status("Initializing components") - - local primaries = {} - for c, t in component.list() do - local s = component.slot(c) - if not primaries[t] or (s >= 0 and s < primaries[t].slot) then - primaries[t] = {address=c, slot=s} - end - computer.pushSignal("component_added", c, t) - end - for t, c in pairs(primaries) do - component.setPrimary(t, c.address) - end -end - --- MineOS Init data -do - -- Загружаем необходимые библиотеки, дабы избежать потерь памяти - local shell = require("shell"); shell.setWorkingDirectory("") - local ecs = require("ECSAPI") - local component = require("component") - -- Загружаем параметры ОС (через инит-метод идет загрузка OSSettings) - require("MineOSCore") - -- Выставляем адекватный масштаб монитора - ecs.fadeOut(background, 0x1b1b1b, 0.05) - ecs.setScale(1) - - -- Завершаем работу с инициализацией - os.sleep(0.1) -- Allow signal processing by libraries. - require("computer").pushSignal("init") - os.sleep(0.1) -- Allow init processing by libraries. - runlevel = 1 -end - -while true do - local result, reason = pcall(loadfile("bin/sh.lua")) - if not result then - io.stderr:write((reason ~= nil and tostring(reason) or "unknown error") .. "\n") - io.write("Press any key to continue.\n") - os.sleep(0.5) - require("event").pull("key") - end -end \ No newline at end of file diff --git a/MineOS/OS.lua b/OS.lua similarity index 99% rename from MineOS/OS.lua rename to OS.lua index 72b07e9b..345c301f 100755 --- a/MineOS/OS.lua +++ b/OS.lua @@ -849,6 +849,8 @@ end ---------------------------------------------- Сама ОС ------------------------------------------------------------------------ +MineOSCore.localization = table.fromFile(MineOSPaths.localizationFiles .. MineOSCore.properties.language .. ".lang") + createOSWindow() changeResolution() changeWallpaper() diff --git a/MineOS/Screensavers/Clock.lua b/Screensavers/Clock.lua similarity index 100% rename from MineOS/Screensavers/Clock.lua rename to Screensavers/Clock.lua diff --git a/MineOS/Screensavers/Lines.lua b/Screensavers/Lines.lua similarity index 100% rename from MineOS/Screensavers/Lines.lua rename to Screensavers/Lines.lua diff --git a/MineOS/Screensavers/Mandala.lua b/Screensavers/Mandala.lua similarity index 100% rename from MineOS/Screensavers/Mandala.lua rename to Screensavers/Mandala.lua diff --git a/MineOS/Screensavers/Matrix.lua b/Screensavers/Matrix.lua similarity index 100% rename from MineOS/Screensavers/Matrix.lua rename to Screensavers/Matrix.lua diff --git a/MineOS/Wallpapers/AhsokaTano.pic b/Wallpapers/AhsokaTano.pic similarity index 100% rename from MineOS/Wallpapers/AhsokaTano.pic rename to Wallpapers/AhsokaTano.pic diff --git a/MineOS/Wallpapers/Block.pic b/Wallpapers/Block.pic similarity index 100% rename from MineOS/Wallpapers/Block.pic rename to Wallpapers/Block.pic diff --git a/MineOS/Wallpapers/Catniss.pic b/Wallpapers/Catniss.pic similarity index 100% rename from MineOS/Wallpapers/Catniss.pic rename to Wallpapers/Catniss.pic diff --git a/MineOS/Wallpapers/ChristmasTree.pic b/Wallpapers/ChristmasTree.pic similarity index 100% rename from MineOS/Wallpapers/ChristmasTree.pic rename to Wallpapers/ChristmasTree.pic diff --git a/MineOS/Wallpapers/Ciri.pic b/Wallpapers/Ciri.pic similarity index 100% rename from MineOS/Wallpapers/Ciri.pic rename to Wallpapers/Ciri.pic diff --git a/MineOS/Wallpapers/CloudyEvening.pic b/Wallpapers/CloudyEvening.pic similarity index 100% rename from MineOS/Wallpapers/CloudyEvening.pic rename to Wallpapers/CloudyEvening.pic diff --git a/MineOS/Wallpapers/Girl.pic b/Wallpapers/Girl.pic similarity index 100% rename from MineOS/Wallpapers/Girl.pic rename to Wallpapers/Girl.pic diff --git a/MineOS/Wallpapers/HilbertCurve.pic b/Wallpapers/HilbertCurve.pic similarity index 100% rename from MineOS/Wallpapers/HilbertCurve.pic rename to Wallpapers/HilbertCurve.pic diff --git a/MineOS/Wallpapers/IcyLeaf.pic b/Wallpapers/IcyLeaf.pic similarity index 100% rename from MineOS/Wallpapers/IcyLeaf.pic rename to Wallpapers/IcyLeaf.pic diff --git a/MineOS/Wallpapers/MoonTouch.pic b/Wallpapers/MoonTouch.pic similarity index 100% rename from MineOS/Wallpapers/MoonTouch.pic rename to Wallpapers/MoonTouch.pic diff --git a/MineOS/Wallpapers/Mystery.pic b/Wallpapers/Mystery.pic similarity index 100% rename from MineOS/Wallpapers/Mystery.pic rename to Wallpapers/Mystery.pic diff --git a/MineOS/Wallpapers/Mystery2.pic b/Wallpapers/Mystery2.pic similarity index 100% rename from MineOS/Wallpapers/Mystery2.pic rename to Wallpapers/Mystery2.pic diff --git a/MineOS/Wallpapers/Nettle.pic b/Wallpapers/Nettle.pic similarity index 100% rename from MineOS/Wallpapers/Nettle.pic rename to Wallpapers/Nettle.pic diff --git a/MineOS/Wallpapers/Nocturnal.pic b/Wallpapers/Nocturnal.pic similarity index 100% rename from MineOS/Wallpapers/Nocturnal.pic rename to Wallpapers/Nocturnal.pic diff --git a/MineOS/Wallpapers/Raspberry.pic b/Wallpapers/Raspberry.pic similarity index 100% rename from MineOS/Wallpapers/Raspberry.pic rename to Wallpapers/Raspberry.pic diff --git a/MineOS/Wallpapers/Road.pic b/Wallpapers/Road.pic similarity index 100% rename from MineOS/Wallpapers/Road.pic rename to Wallpapers/Road.pic diff --git a/MineOS/Wallpapers/SnowyBush.pic b/Wallpapers/SnowyBush.pic similarity index 100% rename from MineOS/Wallpapers/SnowyBush.pic rename to Wallpapers/SnowyBush.pic diff --git a/MineOS/Wallpapers/Space.pic b/Wallpapers/Space.pic similarity index 100% rename from MineOS/Wallpapers/Space.pic rename to Wallpapers/Space.pic diff --git a/MineOS/Wallpapers/TemplarAssassin.pic b/Wallpapers/TemplarAssassin.pic similarity index 100% rename from MineOS/Wallpapers/TemplarAssassin.pic rename to Wallpapers/TemplarAssassin.pic diff --git a/MineOS/Wallpapers/WinterSunrise.pic b/Wallpapers/WinterSunrise.pic similarity index 100% rename from MineOS/Wallpapers/WinterSunrise.pic rename to Wallpapers/WinterSunrise.pic diff --git a/lib/MineOSCore.lua b/lib/MineOSCore.lua index cbea517c..39030718 100755 --- a/lib/MineOSCore.lua +++ b/lib/MineOSCore.lua @@ -2,8 +2,7 @@ require("advancedLua") local component = require("component") local buffer = require("doubleBuffering") -local GUI = require("GUI") -local fs = require("filesystem") +local filesystem = require("filesystem") local unicode = require("unicode") local MineOSPaths = require("MineOSPaths") @@ -15,7 +14,7 @@ MineOSCore.localization = {} ---------------------------------------------------------------------------------------------------------------- function MineOSCore.getCurrentScriptDirectory() - return fs.path(getCurrentScript()) + return filesystem.path(getCurrentScript()) end function MineOSCore.getCurrentApplicationResourcesDirectory() @@ -24,7 +23,7 @@ end function MineOSCore.getLocalization(pathToLocalizationFolder) local localizationFileName = pathToLocalizationFolder .. MineOSCore.properties.language .. ".lang" - if fs.exists(localizationFileName) then + if filesystem.exists(localizationFileName) then return table.fromFile(localizationFileName) else error("Localization file \"" .. localizationFileName .. "\" doesn't exists") @@ -38,7 +37,7 @@ end ----------------------------------------------------------------------------------------------------------------------------------- function MineOSCore.createShortcut(where, forWhat) - fs.makeDirectory(fs.path(where)) + filesystem.makeDirectory(filesystem.path(where)) local file = io.open(where, "w") file:write(forWhat) file:close() @@ -59,7 +58,42 @@ function MineOSCore.saveProperties() end function MineOSCore.loadPropeties() - MineOSCore.properties = table.fromFile(MineOSPaths.properties) + if filesystem.exists(MineOSPaths.properties) then + MineOSCore.properties = table.fromFile(MineOSPaths.properties) + else + MineOSCore.properties = { + language = "Russian", + transparencyEnabled = true, + showApplicationIcons = true, + screensaver = "Matrix", + screensaverDelay = 20, + showHelpOnApplicationStart = true, + dockShortcuts = { + MineOSPaths.applications .. "AppMarket.app/", + MineOSPaths.applications .. "MineCode IDE.app/", + MineOSPaths.applications .. "Finder.app/", + MineOSPaths.applications .. "Photoshop.app/", + }, + backgroundColor = 0x1E1E1E, + network = { + users = {}, + enabled = true, + signalStrength = 512, + }, + extensionAssociations = {}, + } + + MineOSCore.associateExtension(".pic", MineOSPaths.applications .. "/Photoshop.app/Main.lua", MineOSPaths.icons .. "/Image.pic", MineOSPaths.extensionAssociations .. "Pic/ContextMenu.lua") + MineOSCore.associateExtension(".txt", MineOSPaths.editor, MineOSPaths.icons .. "/Text.pic") + MineOSCore.associateExtension(".cfg", MineOSPaths.editor, MineOSPaths.icons .. "/Config.pic") + MineOSCore.associateExtension(".3dm", MineOSPaths.applications .. "/3DPrint.app/Main.lua", MineOSPaths.icons .. "/3DModel.pic") + + MineOSCore.associateExtension("script", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Script.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua") + MineOSCore.associateExtension(".lua", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Lua.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua") + MineOSCore.associateExtension(".pkg", MineOSPaths.extensionAssociations .. "Pkg/Launcher.lua", MineOSPaths.icons .. "/Archive.pic") + + MineOSCore.saveProperties() + end end ----------------------------------------------------------------------------------------------------------------------------------- @@ -87,15 +121,15 @@ end function MineOSCore.associationsExtensionAutomatically() local path, extension = MineOSPaths.extensionAssociations - for file in fs.list(path) do - if fs.isDirectory(path .. file) then + for file in filesystem.list(path) do + if filesystem.isDirectory(path .. file) then extension = "." .. unicode.sub(file, 1, -2) - if fs.exists(path .. file .. "ContextMenu.lua") then + if filesystem.exists(path .. file .. "ContextMenu.lua") then MineOSCore.associateExtensionContextMenu(extension, path .. file .. "Context menu.lua") end - if fs.exists(path .. file .. "Launcher.lua") then + if filesystem.exists(path .. file .. "Launcher.lua") then MineOSCore.associateExtensionLauncher(extension, path .. file .. "Launcher.lua") end end @@ -174,7 +208,7 @@ function MineOSCore.safeLaunch(path, ...) local oldResolutionWidth, oldResolutionHeight = buffer.width, buffer.height local finalSuccess, finalPath, finalLine, finalTraceback = true - if fs.exists(path) then + if filesystem.exists(path) then local loadSuccess, loadReason = loadfile("/" .. path) if loadSuccess then local success, path, line, traceback = MineOSCore.call(loadSuccess, ...) @@ -186,7 +220,7 @@ function MineOSCore.safeLaunch(path, ...) finalSuccess, finalPath, finalLine, finalTraceback = false, path, tonumber(match) or 1, loadReason end else - GUI.error("Failed to safely launch file that doesn't exists: \"" .. path .. "\"") + require("GUI").error("Failed to safely launch file that doesn't exists: \"" .. path .. "\"") end component.screen.setPrecise(false) @@ -198,29 +232,6 @@ end ----------------------------------------------------------------------------------------------------------------------------------- MineOSCore.loadPropeties() -MineOSCore.localization = table.fromFile(MineOSPaths.localizationFiles .. MineOSCore.properties.language .. ".lang") -fs.makeDirectory(MineOSPaths.trash) - -MineOSCore.properties.extensionAssociations = MineOSCore.properties.extensionAssociations or {} - -MineOSCore.associateExtension(".pic", MineOSPaths.applications .. "/Photoshop.app/Main.lua", MineOSPaths.icons .. "/Image.pic", MineOSPaths.extensionAssociations .. "Pic/ContextMenu.lua") -MineOSCore.associateExtension(".txt", MineOSPaths.editor, MineOSPaths.icons .. "/Text.pic") -MineOSCore.associateExtension(".cfg", MineOSPaths.editor, MineOSPaths.icons .. "/Config.pic") -MineOSCore.associateExtension(".3dm", MineOSPaths.applications .. "/3DPrint.app/Main.lua", MineOSPaths.icons .. "/3DModel.pic") - -MineOSCore.associateExtension("script", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Script.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua") -MineOSCore.associateExtension(".lua", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Lua.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua") -MineOSCore.associateExtension(".pkg", MineOSPaths.extensionAssociations .. "Pkg/Launcher.lua", MineOSPaths.icons .. "/Archive.pic") - -MineOSCore.saveProperties() - --- buffer.clear(0x0) --- buffer.draw(true) - --- local cykaContainer = GUI.fullScreenContainer() --- cykaContainer:addChild(GUI.panel(1, 1, cykaContainer.width, cykaContainer.height, 0xFF0000)) - --- GUICopy(cykaContainer, "/MineOS/papka/", "/MineOS/mamka/", true) ----------------------------------------------------------------------------------------------------------------------------------- diff --git a/lib/MineOSPaths.lua b/lib/MineOSPaths.lua index 122634de..8b255c0c 100755 --- a/lib/MineOSPaths.lua +++ b/lib/MineOSPaths.lua @@ -1,4 +1,5 @@ +local filesystem = require("filesystem") local MineOSPaths = {} ---------------------------------------------------------------------------------------------------------------- @@ -7,7 +8,7 @@ MineOSPaths.OS = "/MineOS/" MineOSPaths.downloads = MineOSPaths.OS .. "Downloads/" MineOSPaths.system = MineOSPaths.OS .. "System/" MineOSPaths.applicationData = MineOSPaths.system .. "Application data/" -MineOSPaths.extensionAssociations = MineOSPaths.system .. "ExtensionAssociations/" +MineOSPaths.extensionAssociations = MineOSPaths.system .. "Extensions/" MineOSPaths.localizationFiles = MineOSPaths.system .. "Localization/" MineOSPaths.icons = MineOSPaths.system .. "Icons/" MineOSPaths.applications = MineOSPaths.OS .. "Applications/" @@ -21,4 +22,10 @@ MineOSPaths.explorer = MineOSPaths.applications .. "/Finder.app/Main.lua" ---------------------------------------------------------------------------------------------------------------- +filesystem.makeDirectory(MineOSPaths.pictures) +filesystem.makeDirectory(MineOSPaths.applicationData) +filesystem.makeDirectory(MineOSPaths.trash) + +---------------------------------------------------------------------------------------------------------------- + return MineOSPaths \ No newline at end of file