|
|
@ -153,22 +153,20 @@ func (r RecycleBinService) Clear() error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getClashDir(realPath string) (string, error) { |
|
|
|
func getClashDir(realPath string) (string, error) { |
|
|
|
trimmedPath := strings.Trim(realPath, "/") |
|
|
|
partitions, err := disk.Partitions(false) |
|
|
|
parts := strings.Split(trimmedPath, "/") |
|
|
|
if err != nil { |
|
|
|
dir := "" |
|
|
|
return "", err |
|
|
|
if len(parts) > 0 { |
|
|
|
} |
|
|
|
dir = parts[0] |
|
|
|
for _, p := range partitions { |
|
|
|
partitions, err := disk.Partitions(false) |
|
|
|
if p.Mountpoint == "/" { |
|
|
|
if err != nil { |
|
|
|
continue |
|
|
|
return "", err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
for _, p := range partitions { |
|
|
|
if strings.HasPrefix(realPath, p.Mountpoint) { |
|
|
|
if p.Mountpoint == dir { |
|
|
|
clashDir := path.Join(p.Mountpoint, ".1panel_clash") |
|
|
|
if err = createClashDir(path.Join(p.Mountpoint, ".1panel_clash")); err != nil { |
|
|
|
if err = createClashDir(path.Join(p.Mountpoint, ".1panel_clash")); err != nil { |
|
|
|
return "", err |
|
|
|
return "", err |
|
|
|
} |
|
|
|
|
|
|
|
return dir, nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return clashDir, nil |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return constant.RecycleBinDir, createClashDir(constant.RecycleBinDir) |
|
|
|
return constant.RecycleBinDir, createClashDir(constant.RecycleBinDir) |
|
|
|