Skip to content

Commit

Permalink
Update to miniOS 0.6.2, properly this time.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyem123 committed Apr 5, 2020
1 parent 6b3fd2d commit eafea1c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 19 deletions.
3 changes: 3 additions & 0 deletions miniOS/LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
miniOS is written by Skye M.
The code is partially based on code from the OpenComputers mod under the MIT licence (see LICENCE.mit).
Modifications and extensions to the code, and new code is under the 2-clause BSD licence (see LICENCE.bsd).
25 changes: 25 additions & 0 deletions miniOS/LICENCE.bsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2020, Skye M.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 changes: 19 additions & 0 deletions miniOS/LICENCE.mit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2013-2015 Florian "Sangar" Nücke

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
6 changes: 4 additions & 2 deletions miniOS/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ local function listdrives()
end
end

local function lables()
local function labels()
for letter, address in fs.drive.list() do
print(letter, component.invoke(address, "getLabel") or "")
end
Expand Down Expand Up @@ -205,7 +205,8 @@ local function runline(line)
if command == "disks" then listdrives() return true end
if command == "discs" then listdrives() return true end
if command == "drives" then listdrives() return true end
if command == "labels" then lables() return true end
if command == "labels" then labels() return true end
if command == "scndrv" then filesystem.drive.scan() return true end
if command == "label" then if parts[2] then label(parts) return true else printErr("Invalid Parameters") return false end end
if command == "type" then outputFile(fixPath(parts[2])) return true end
if command == "more" then outputFile(fixPath(parts[2]), true) return true end
Expand All @@ -228,6 +229,7 @@ cmds --- Lists the commands.
intro -- Outputs the introduction message.
drives - Lists the drives and their addresses.
labels - Lists the drives and their labels.
scndrv - Updates the drive list.
label -- Sets the label of a drive.
echo --- Outputs its arguments.
type --- Like echo, but outputs a file.
Expand Down
39 changes: 24 additions & 15 deletions miniOS/miniOS.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_G._OSNAME = "miniOS classic"
_G._OSVER = "0.6.2-pre.1"
_G._OSVER = "0.6.2"
_G._OSVERSION = _OSNAME .. " " .. _OSVER
_G._OSCREDIT = "miniOS classic by Skye, based off of OpenOS code from OpenComputers.\nminiOS code is under BSD 2-clause license, OpenOS code is under the MIT license."
_G._OSCREDIT = "miniOS classic by Skye, based off of OpenOS code from OpenComputers.\nminiOS code is under BSD 2-clause licence, OpenOS code is under the MIT licence."

--component code
function component_code()
Expand Down Expand Up @@ -432,14 +432,14 @@ function fs_code()
fs.drive._map = {}
--converts a drive letter into a proxy
function fs.drive.letterToProxy(letter)
return fs.drive._map[letter]
return fs.drive._map[letter]
end
--finds the proxy associated with the letter
function fs.drive.proxyToLetter(proxy)
for l,p in pairs(fs.drive._map) do
if p == proxy then return l end
end
return nil
if p == proxy then return l end
end
return nil
end
--maps a proxy to a letter
function fs.drive.mapProxy(letter, proxy)
Expand All @@ -457,8 +457,9 @@ function fs_code()
return nil
end
function fs.drive.mapAddress(letter, address)
--print("mapAddress")
fs.drive._map[letter] = fs.proxy(address)
--print("mapAddress")
if address == nil then fs.drive._map[letter] = nil
else fs.drive._map[letter] = fs.proxy(address) end
end
function fs.drive.autoMap(address) --returns the letter if mapped OR already mapped, false if not.
--print("autoMap")
Expand Down Expand Up @@ -517,6 +518,20 @@ function fs_code()
return drive, path
end
function fs.drive.getcurrent() return fs.drive._current end
function fs.drive.scan()
local to_remove = {}
for letter,proxy in pairs(fs.drive._map) do
if component.type(proxy.address) == nil then
to_remove[#to_remove + 1] = letter
end
end
for _,l in ipairs(to_remove) do
fs.drive._map[l] = nil
end
for address, componentType in component.list() do
if componentType == "filesystem" then filesystem.drive.autoMap(address) end
end
end
function fs.invoke(method, ...) return fs.drive._map[fs.drive._current][method](...) end
function fs.proxy(filter)
checkArg(1, filter, "string")
Expand Down Expand Up @@ -1296,10 +1311,7 @@ print(_OSCREDIT .. "\n")
--clean up libs
event_code, component_code, text_code, fs_code, terminal_code, keyboard_code = nil, nil, nil, nil, nil, nil

--map the drives
for address, componentType in component.list() do
if componentType == "filesystem" then filesystem.drive.autoMap(address) end
end
filesystem.drive.scan()

miniOS = {}
local function interrupt(data)
Expand Down Expand Up @@ -1412,8 +1424,5 @@ while true do
if not miniOS.cmdBat then print() end
fs.drive.setcurrent(fallback_drive)
local new = false;
--print(new)
if not shellrun("command.lua", (not new and "-c") or nil) then new = true; printErr("Will restart command interpreter..."); kernelError(); end
--print("uh")
--os.sleep(1)
end
2 changes: 1 addition & 1 deletion miniOS/version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
miniOS classic
0.6.2-pre.1
0.6.2
Alpha
2 changes: 1 addition & 1 deletion miniOSNT
Submodule miniOSNT updated from f48949 to f2bb63

0 comments on commit eafea1c

Please sign in to comment.