From c11469a108154bdece014e0d39e2c062a4159740 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Tue, 14 Oct 2025 19:26:05 +0800 Subject: [PATCH] ToolFile+AbsPath --- Convention/Runtime/File.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Convention/Runtime/File.py b/Convention/Runtime/File.py index 203b10e..f19c983 100644 --- a/Convention/Runtime/File.py +++ b/Convention/Runtime/File.py @@ -1,3 +1,4 @@ +import os.path from .Config import * import json import shutil @@ -61,9 +62,7 @@ class ToolFile(BaseModel): self, filePath: Union[str, Self], ): - filePath = os.path.expandvars(str(filePath)) - if filePath[1:].startswith(":/") or filePath[1:].startswith(":\\"): - filePath = os.path.abspath(filePath) + filePath = os.path.expandvars(str(filePath)).replace('\\','/') super().__init__(OriginFullPath=filePath) def __del__(self): pass @@ -408,6 +407,8 @@ class ToolFile(BaseModel): return os.path.getsize(self.OriginFullPath) def GetExtension(self): return GetExtensionName(self.OriginFullPath) + def GetAbsPath(self) -> str: + return os.path.abspath(self.OriginFullPath) def GetFullPath(self) -> str: return self.OriginFullPath def GetFilename(self, is_without_extension = False):