added text files to DIR output, implement TYPE to show them

This commit is contained in:
Alexander Weber 2018-02-24 00:36:19 +01:00
parent 1418a5f6e6
commit a0e41af20d
2 changed files with 40 additions and 6 deletions

View File

@ -220,6 +220,43 @@ laptop.register_app("cs-bos_launcher", {
add_outline(data, k:upper().."* " .. (v.app_info or ""))
end
end
local txtdata = mtos.bdev:get_app_storage('hdd', 'stickynote:files')
if txtdata then
for k, v in pairs(txtdata) do
add_outline(data, "HDD:"..k.." "..v.owner.." "..os.date("%M:%S %p, %A %B %d, %Y", v.ctime))
end
end
local txtdata = mtos.bdev:get_app_storage('removable', 'stickynote:files')
if txtdata then
for k, v in pairs(txtdata) do
add_outline(data, "FDD:"..k.." "..v.owner.." "..os.date("%I:%M:%S %p, %A %B %d, %Y", v.ctime))
end
end
elseif exec_command == "TYPE" then
if exec_all[2] then
local filename = input_line:sub(6):gsub("^%s*(.-)%s*$", "%1")
local disk
if filename:sub(1,4):upper() == 'HDD:' then
disk = 'hdd'
filename = filename:sub(5)
elseif filename:sub(1,4):upper() == 'FDD:' then
disk = 'removable'
filename = filename:sub(5)
else
disk = 'system'
end
local txtdata = mtos.bdev:get_app_storage(disk, 'stickynote:files')
if txtdata then
local file = txtdata[filename]
if file and file.content then
for s in file.content:gmatch("[^\n]+") do
add_outline(data, s)
end
end
end
else
add_outline(data, '?SYNATX ERROR')
end
elseif exec_command == "CLS" then
data.outlines = {}
elseif exec_command == "TIME" then

View File

@ -145,12 +145,9 @@ function bdev:get_app_storage(disk_type, store_name)
return nil
end
elseif disk_type == 'system' then
if self.system_disk == nil then
local runtime = self:get_app_storage("ram", "os")
runtime.booted_from = runtime.booted_from or self:get_boot_disk()
self.system_disk = self:get_app_storage(runtime.booted_from, store_name)
end
return self.system_disk
local runtime = self:get_app_storage("ram", "os")
runtime.booted_from = runtime.booted_from or self:get_boot_disk()
return self:get_app_storage(runtime.booted_from, store_name)
elseif disk_type == 'cloud' then
return self:get_cloud_disk(store_name) or nil
end