Skip to content

Commit eafea1c

Browse files
committed
Update to miniOS 0.6.2, properly this time.
1 parent 6b3fd2d commit eafea1c

File tree

7 files changed

+77
-19
lines changed

7 files changed

+77
-19
lines changed

miniOS/LICENCE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
miniOS is written by Skye M.
2+
The code is partially based on code from the OpenComputers mod under the MIT licence (see LICENCE.mit).
3+
Modifications and extensions to the code, and new code is under the 2-clause BSD licence (see LICENCE.bsd).

miniOS/LICENCE.bsd

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2020, Skye M.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

miniOS/LICENCE.mit

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013-2015 Florian "Sangar" Nücke
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

miniOS/command.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ local function listdrives()
5555
end
5656
end
5757

58-
local function lables()
58+
local function labels()
5959
for letter, address in fs.drive.list() do
6060
print(letter, component.invoke(address, "getLabel") or "")
6161
end
@@ -205,7 +205,8 @@ local function runline(line)
205205
if command == "disks" then listdrives() return true end
206206
if command == "discs" then listdrives() return true end
207207
if command == "drives" then listdrives() return true end
208-
if command == "labels" then lables() return true end
208+
if command == "labels" then labels() return true end
209+
if command == "scndrv" then filesystem.drive.scan() return true end
209210
if command == "label" then if parts[2] then label(parts) return true else printErr("Invalid Parameters") return false end end
210211
if command == "type" then outputFile(fixPath(parts[2])) return true end
211212
if command == "more" then outputFile(fixPath(parts[2]), true) return true end
@@ -228,6 +229,7 @@ cmds --- Lists the commands.
228229
intro -- Outputs the introduction message.
229230
drives - Lists the drives and their addresses.
230231
labels - Lists the drives and their labels.
232+
scndrv - Updates the drive list.
231233
label -- Sets the label of a drive.
232234
echo --- Outputs its arguments.
233235
type --- Like echo, but outputs a file.

miniOS/miniOS.lua

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
_G._OSNAME = "miniOS classic"
2-
_G._OSVER = "0.6.2-pre.1"
2+
_G._OSVER = "0.6.2"
33
_G._OSVERSION = _OSNAME .. " " .. _OSVER
4-
_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."
4+
_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."
55

66
--component code
77
function component_code()
@@ -432,14 +432,14 @@ function fs_code()
432432
fs.drive._map = {}
433433
--converts a drive letter into a proxy
434434
function fs.drive.letterToProxy(letter)
435-
return fs.drive._map[letter]
435+
return fs.drive._map[letter]
436436
end
437437
--finds the proxy associated with the letter
438438
function fs.drive.proxyToLetter(proxy)
439439
for l,p in pairs(fs.drive._map) do
440-
if p == proxy then return l end
441-
end
442-
return nil
440+
if p == proxy then return l end
441+
end
442+
return nil
443443
end
444444
--maps a proxy to a letter
445445
function fs.drive.mapProxy(letter, proxy)
@@ -457,8 +457,9 @@ function fs_code()
457457
return nil
458458
end
459459
function fs.drive.mapAddress(letter, address)
460-
--print("mapAddress")
461-
fs.drive._map[letter] = fs.proxy(address)
460+
--print("mapAddress")
461+
if address == nil then fs.drive._map[letter] = nil
462+
else fs.drive._map[letter] = fs.proxy(address) end
462463
end
463464
function fs.drive.autoMap(address) --returns the letter if mapped OR already mapped, false if not.
464465
--print("autoMap")
@@ -517,6 +518,20 @@ function fs_code()
517518
return drive, path
518519
end
519520
function fs.drive.getcurrent() return fs.drive._current end
521+
function fs.drive.scan()
522+
local to_remove = {}
523+
for letter,proxy in pairs(fs.drive._map) do
524+
if component.type(proxy.address) == nil then
525+
to_remove[#to_remove + 1] = letter
526+
end
527+
end
528+
for _,l in ipairs(to_remove) do
529+
fs.drive._map[l] = nil
530+
end
531+
for address, componentType in component.list() do
532+
if componentType == "filesystem" then filesystem.drive.autoMap(address) end
533+
end
534+
end
520535
function fs.invoke(method, ...) return fs.drive._map[fs.drive._current][method](...) end
521536
function fs.proxy(filter)
522537
checkArg(1, filter, "string")
@@ -1296,10 +1311,7 @@ print(_OSCREDIT .. "\n")
12961311
--clean up libs
12971312
event_code, component_code, text_code, fs_code, terminal_code, keyboard_code = nil, nil, nil, nil, nil, nil
12981313

1299-
--map the drives
1300-
for address, componentType in component.list() do
1301-
if componentType == "filesystem" then filesystem.drive.autoMap(address) end
1302-
end
1314+
filesystem.drive.scan()
13031315

13041316
miniOS = {}
13051317
local function interrupt(data)
@@ -1412,8 +1424,5 @@ while true do
14121424
if not miniOS.cmdBat then print() end
14131425
fs.drive.setcurrent(fallback_drive)
14141426
local new = false;
1415-
--print(new)
14161427
if not shellrun("command.lua", (not new and "-c") or nil) then new = true; printErr("Will restart command interpreter..."); kernelError(); end
1417-
--print("uh")
1418-
--os.sleep(1)
14191428
end

miniOS/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
miniOS classic
2-
0.6.2-pre.1
2+
0.6.2
33
Alpha

miniOSNT

Submodule miniOSNT updated from f489494 to f2bb63f

0 commit comments

Comments
 (0)