mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
normpath
This commit is contained in:
parent
7a1f8f32da
commit
acf55a3b27
@ -20,6 +20,7 @@
|
|||||||
# ========================================================================== #
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
|
||||||
@ -62,8 +63,8 @@ def _find_partitions(part_type: str, single: bool) -> list[Partition]:
|
|||||||
options = dict(re.findall(r"X-kvmd\.%s-(root|user)(?:=([^,]+))?" % (part_type), fields[3]))
|
options = dict(re.findall(r"X-kvmd\.%s-(root|user)(?:=([^,]+))?" % (part_type), fields[3]))
|
||||||
if options:
|
if options:
|
||||||
parts.append(Partition(
|
parts.append(Partition(
|
||||||
mount_path=fields[1],
|
mount_path=os.path.normpath(fields[1]),
|
||||||
root_path=(options.get("root", "") or fields[1]),
|
root_path=os.path.normpath(options.get("root", "") or fields[1]),
|
||||||
user=options.get("user", ""),
|
user=options.get("user", ""),
|
||||||
))
|
))
|
||||||
if single:
|
if single:
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class Drive:
|
|||||||
self.__set_param("forced_eject", "")
|
self.__set_param("forced_eject", "")
|
||||||
|
|
||||||
def get_image_path(self) -> str:
|
def get_image_path(self) -> str:
|
||||||
return self.__get_param("file")
|
path = self.__get_param("file")
|
||||||
|
return (os.path.normpath(path) if path else "")
|
||||||
|
|
||||||
def set_cdrom_flag(self, flag: bool) -> None:
|
def set_cdrom_flag(self, flag: bool) -> None:
|
||||||
self.__set_param("cdrom", str(int(flag)))
|
self.__set_param("cdrom", str(int(flag)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user