mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
use all flag to check drives
This commit is contained in:
+13
-5
@@ -68,14 +68,24 @@ def get_all_drives(is_win: bool = False):
|
||||
"""
|
||||
Returns a list of all the drives on a Windows machine.
|
||||
"""
|
||||
drives = psutil.disk_partitions()
|
||||
drives = psutil.disk_partitions(all=True)
|
||||
drives = [d.mountpoint for d in drives]
|
||||
|
||||
if is_win:
|
||||
drives = [win_replace_slash(d) for d in drives]
|
||||
else:
|
||||
remove = ["/boot", "/boot/efi", "/tmp"]
|
||||
drives = [d for d in drives if d not in remove]
|
||||
remove = (
|
||||
"/boot",
|
||||
"/tmp",
|
||||
"/snap",
|
||||
"/var",
|
||||
"/sys",
|
||||
"/proc",
|
||||
"/etc",
|
||||
"/run",
|
||||
"/dev",
|
||||
)
|
||||
drives = [d for d in drives if not d.startswith(remove)]
|
||||
|
||||
return drives
|
||||
|
||||
@@ -94,8 +104,6 @@ def list_folders():
|
||||
req_dir = "$root"
|
||||
|
||||
if req_dir == "$root":
|
||||
# req_dir = settings.USER_HOME_DIR
|
||||
# if is_win:
|
||||
return {
|
||||
"folders": [{"name": d, "path": d} for d in get_all_drives(is_win=is_win)]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user