Skip to content

Commit 6418698

Browse files
lpnhsxyazi
authored andcommitted
fix(mount): partition regex for linux (#53)
1 parent 7707c09 commit 6418698

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mount.yazi/main.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,10 @@ function M.obtain()
177177
local main, sub
178178
if ya.target_os() == "macos" then
179179
main, sub = p.src:match("^(/dev/disk%d+)(.+)$")
180-
else
181-
main, sub = p.src:match("^(/dev/[a-z]+[a-z])(%d+)$")
180+
elseif p.src:find("/dev/nvme", 1, true) == 1 then -- /dev/nvme0n1p1
181+
main, sub = p.src:match("^(/dev/nvme%d+n%d+)(p%d+)$")
182+
elseif p.src:find("/dev/sd", 1, true) == 1 then -- /dev/sda1
183+
main, sub = p.src:match("^(/dev/sd[a-z])(%d+)$")
182184
end
183185
if sub then
184186
if last ~= main then

0 commit comments

Comments
 (0)