ToolFile+AbsPath
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import os.path
|
||||||
from .Config import *
|
from .Config import *
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
@@ -61,9 +62,7 @@ class ToolFile(BaseModel):
|
|||||||
self,
|
self,
|
||||||
filePath: Union[str, Self],
|
filePath: Union[str, Self],
|
||||||
):
|
):
|
||||||
filePath = os.path.expandvars(str(filePath))
|
filePath = os.path.expandvars(str(filePath)).replace('\\','/')
|
||||||
if filePath[1:].startswith(":/") or filePath[1:].startswith(":\\"):
|
|
||||||
filePath = os.path.abspath(filePath)
|
|
||||||
super().__init__(OriginFullPath=filePath)
|
super().__init__(OriginFullPath=filePath)
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
pass
|
pass
|
||||||
@@ -408,6 +407,8 @@ class ToolFile(BaseModel):
|
|||||||
return os.path.getsize(self.OriginFullPath)
|
return os.path.getsize(self.OriginFullPath)
|
||||||
def GetExtension(self):
|
def GetExtension(self):
|
||||||
return GetExtensionName(self.OriginFullPath)
|
return GetExtensionName(self.OriginFullPath)
|
||||||
|
def GetAbsPath(self) -> str:
|
||||||
|
return os.path.abspath(self.OriginFullPath)
|
||||||
def GetFullPath(self) -> str:
|
def GetFullPath(self) -> str:
|
||||||
return self.OriginFullPath
|
return self.OriginFullPath
|
||||||
def GetFilename(self, is_without_extension = False):
|
def GetFilename(self, is_without_extension = False):
|
||||||
|
Reference in New Issue
Block a user