fix: Linux compatibility
This commit is contained in:
@@ -43,7 +43,7 @@ local M = {
|
|||||||
{ on = "<Right>", run = "right" },
|
{ on = "<Right>", run = "right" },
|
||||||
|
|
||||||
{ on = "m", run = "mount" },
|
{ on = "m", run = "mount" },
|
||||||
{ on = "M", run = "umount" },
|
{ on = "M", run = "unmount" },
|
||||||
{ on = "e", run = "eject" },
|
{ on = "e", run = "eject" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -126,8 +126,8 @@ function M:entry(job)
|
|||||||
break
|
break
|
||||||
elseif run == "mount" then
|
elseif run == "mount" then
|
||||||
self.operate("mount")
|
self.operate("mount")
|
||||||
elseif run == "umount" then
|
elseif run == "unmount" then
|
||||||
self.operate("umount")
|
self.operate("unmount")
|
||||||
elseif run == "eject" then
|
elseif run == "eject" then
|
||||||
self.operate("eject")
|
self.operate("eject")
|
||||||
end
|
end
|
||||||
@@ -145,7 +145,7 @@ function M:redraw()
|
|||||||
if p.sub == "" then
|
if p.sub == "" then
|
||||||
rows[#rows + 1] = ui.Row { p.main }
|
rows[#rows + 1] = ui.Row { p.main }
|
||||||
else
|
else
|
||||||
rows[#rows + 1] = ui.Row { p.sub, p.label, p.dist or "", p.fstype }
|
rows[#rows + 1] = ui.Row { p.sub, p.label or "", p.dist or "", p.fstype or "" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -172,17 +172,19 @@ end
|
|||||||
|
|
||||||
function M.obtain()
|
function M.obtain()
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
local last = { false, nil }
|
local last
|
||||||
for _, p in ipairs(fs.partitions()) do
|
for _, p in ipairs(fs.partitions()) do
|
||||||
local main, sub = p.src:match("^(/dev/disk%d+)(.*)$")
|
local main, sub
|
||||||
if sub == "" then
|
if ya.target_os() == "macos" then
|
||||||
p.main, p.sub, last = main, sub, { true, p }
|
main, sub = p.src:match("^(/dev/disk%d+)(.+)$")
|
||||||
elseif not p.fstype then
|
|
||||||
else
|
else
|
||||||
if last[1] then
|
main, sub = p.src:match("^(/dev/[a-z]+[a-z])(%d+)$")
|
||||||
tbl[#tbl + 1], last[1] = last[2], false
|
|
||||||
end
|
end
|
||||||
p.main, p.sub, tbl[#tbl + 1] = last[2].main, " " .. sub, p
|
if sub then
|
||||||
|
if last ~= main then
|
||||||
|
last, tbl[#tbl + 1] = main, { src = main, main = main, sub = "" }
|
||||||
|
end
|
||||||
|
p.main, p.sub, tbl[#tbl + 1] = main, " " .. sub, p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(tbl, function(a, b)
|
table.sort(tbl, function(a, b)
|
||||||
@@ -200,7 +202,7 @@ function M.operate(type)
|
|||||||
if not active then
|
if not active then
|
||||||
return
|
return
|
||||||
elseif active.sub == "" then
|
elseif active.sub == "" then
|
||||||
return -- TODO: mount/umount main disk
|
return -- TODO: mount/unmount main disk
|
||||||
end
|
end
|
||||||
|
|
||||||
local output, err
|
local output, err
|
||||||
|
|||||||
Reference in New Issue
Block a user