ЖукоПравки

This commit is contained in:
Igor Timofeev 2019-01-21 16:25:02 +03:00
parent 406b6e121c
commit fd035c57c2
7 changed files with 19 additions and 29 deletions

View File

@ -514,7 +514,7 @@ local function download(publication)
callLastMethod() callLastMethod()
if not shortcutSwitchAndLabel.hidden and shortcutSwitchAndLabel.switch.state then if not shortcutSwitchAndLabel.hidden and shortcutSwitchAndLabel.switch.state then
system.createShortcut(paths.user.desktop .. filesystem.hideExtension(filesystem.name(filesystemChooser.path)) .. ".lnk", filesystemChooser.path .. "/") system.createShortcut(paths.user.desktop .. filesystem.hideExtension(filesystem.name(filesystemChooser.path)), filesystemChooser.path .. "/")
end end
computer.pushSignal("system", "updateFileList") computer.pushSignal("system", "updateFileList")

View File

@ -56,7 +56,7 @@ local function filesystemPath(path)
end end
local function filesystemName(path) local function filesystemName(path)
return path:match("%/?([^%/]+)%/?$") return path:match("%/?([^%/]+%/?)$")
end end
local function filesystemHideExtension(path) local function filesystemHideExtension(path)
@ -504,11 +504,11 @@ addStage(function()
workspace:draw() workspace:draw()
-- Switching to selected filesystem proxy for performing system library operations -- Switching to selected filesystem proxy for performing system library operations
filesystem.setProxy(selectedFilesystemProxy)
-- Creating system paths -- Creating system paths
paths.create(paths.system) filesystem.setProxy(selectedFilesystemProxy)
paths.create(paths.system)
local userProperties, userPaths = system.createUser( local userProperties, userPaths = system.createUser(
usernameInput.text, usernameInput.text,
filesystemHideExtension(filesystemName(files.localizations[localizationComboBox.selectedItem])), filesystemHideExtension(filesystemName(files.localizations[localizationComboBox.selectedItem])),
@ -517,10 +517,6 @@ addStage(function()
screensaversSwitchAndLabel.switch.state screensaversSwitchAndLabel.switch.state
) )
-- Renaming HDD
temporaryFilesystemProxy.setLabel("MineOS HDD")
-- Switching back to temporary fileystem proxy
filesystem.setProxy(temporaryFilesystemProxy) filesystem.setProxy(temporaryFilesystemProxy)
-- Flashing EEPROM -- Flashing EEPROM
@ -580,10 +576,14 @@ addStage(function()
-- Create shortcut if possible -- Create shortcut if possible
if shortcut then if shortcut then
filesystem.setProxy(selectedFilesystemProxy)
system.createShortcut( system.createShortcut(
userPaths.desktop .. filesystemHideExtension(filesystemName(filesystemPath(path)) .. "/") .. ".lnk", userPaths.desktop .. filesystemHideExtension(filesystemName(filesystemPath(path))),
OSPath .. filesystemPath(path) OSPath .. filesystemPath(path)
) )
filesystem.setProxy(temporaryFilesystemProxy)
end end
progressBar.value = math.floor(i / #downloadList * 100) progressBar.value = math.floor(i / #downloadList * 100)

View File

@ -13,15 +13,3 @@ end
function component.isAvailable(type) function component.isAvailable(type)
return component.list(type)() and true or false return component.list(type)() and true or false
end end
-- Allows writing component.gpu.set(...) instead of component.get("gpu").set(...)
setmetatable(component, {
__index = function(_, key)
local proxy, reason = component.get(key)
if proxy then
return proxy
else
error(reason)
end
end
})

View File

@ -52,7 +52,7 @@ function event.skip(signalType)
end end
function event.pull(preferredTimeout) function event.pull(preferredTimeout)
local uptime = computerUptime() local uptime, signalData = computerUptime()
local deadline = uptime + (preferredTimeout or mathHuge) local deadline = uptime + (preferredTimeout or mathHuge)
repeat repeat

View File

@ -540,7 +540,7 @@ local function newModemProxy(address)
return request("read", "", ...) return request("read", "", ...)
end end
write = function(handle, data) proxy.write = function(handle, data)
local maxPacketSize = network.modemProxy.maxPacketSize() - network.modemPacketReserve local maxPacketSize = network.modemProxy.maxPacketSize() - network.modemPacketReserve
repeat repeat
if not request("write", false, handle, data:sub(1, maxPacketSize)) then if not request("write", false, handle, data:sub(1, maxPacketSize)) then
@ -681,7 +681,7 @@ function network.update()
end end
end end
proxy = newModemProxy(eventData[3]) local proxy = newModemProxy(eventData[3])
proxy.name = eventData[8] proxy.name = eventData[8]
filesystem.mount(proxy, paths.system.mounts .. eventData[3] .. "/") filesystem.mount(proxy, paths.system.mounts .. eventData[3] .. "/")

View File

@ -106,7 +106,7 @@ end
function system.createShortcut(where, forWhat) function system.createShortcut(where, forWhat)
filesystem.makeDirectory(filesystem.path(where)) filesystem.makeDirectory(filesystem.path(where))
filesystem.write(where, forWhat) filesystem.write(where .. ".lnk", forWhat)
end end
function system.parseArguments(...) function system.parseArguments(...)
@ -827,7 +827,7 @@ local function iconOnRightClick(icon, e1, e2, e3, e4)
for i = 1, #selectedIcons do for i = 1, #selectedIcons do
if not selectedIcons[i].isShortcut then if not selectedIcons[i].isShortcut then
system.createShortcut( system.createShortcut(
filesystem.path(selectedIcons[i].path) .. selectedIcons[i].nameWithoutExtension .. ".lnk", filesystem.path(selectedIcons[i].path) .. selectedIcons[i].nameWithoutExtension,
selectedIcons[i].path selectedIcons[i].path
) )
end end
@ -840,7 +840,7 @@ local function iconOnRightClick(icon, e1, e2, e3, e4)
for i = 1, #selectedIcons do for i = 1, #selectedIcons do
if not selectedIcons[i].isShortcut then if not selectedIcons[i].isShortcut then
system.createShortcut( system.createShortcut(
paths.user.desktop .. selectedIcons[i].nameWithoutExtension .. ".lnk", paths.user.desktop .. selectedIcons[i].nameWithoutExtension,
selectedIcons[i].path selectedIcons[i].path
) )
end end

6
OS.lua
View File

@ -33,9 +33,11 @@ end
-- Initializing global package system -- Initializing global package system
package = { package = {
paths = {["/Libraries/"] = true}, paths = {
["/Libraries/"] = true
},
loaded = {}, loaded = {},
loading = {}, loading = {}
} }
-- Checks existense of specified path. It will be overriden after filesystem library initialization -- Checks existense of specified path. It will be overriden after filesystem library initialization