mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 18:05:05 +00:00
no longer land in a meaningless Volumes
This commit is contained in:
BIN
bin/analyze-go
BIN
bin/analyze-go
Binary file not shown.
@@ -445,13 +445,34 @@ func createOverviewEntries() []dirEntry {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Add Volumes if exists
|
// Add Volumes if exists
|
||||||
if _, err := os.Stat("/Volumes"); err == nil {
|
if hasUsefulVolumeMounts("/Volumes") {
|
||||||
entries = append(entries, dirEntry{name: "Volumes", path: "/Volumes", isDir: true, size: -1})
|
entries = append(entries, dirEntry{name: "Volumes", path: "/Volumes", isDir: true, size: -1})
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func hasUsefulVolumeMounts(path string) bool {
|
||||||
|
entries, err := os.ReadDir(path)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
if entry.Type()&fs.ModeSymlink != 0 {
|
||||||
|
continue // Skip synthetic system links like "Macintosh HD"
|
||||||
|
}
|
||||||
|
info, err := entry.Info()
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if info.IsDir() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (m *model) hydrateOverviewEntries() {
|
func (m *model) hydrateOverviewEntries() {
|
||||||
m.entries = createOverviewEntries()
|
m.entries = createOverviewEntries()
|
||||||
if m.overviewSizeCache == nil {
|
if m.overviewSizeCache == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user