add: home page
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
class Path():
|
||||
|
||||
@ -8,6 +9,7 @@ class Path():
|
||||
self._absolute_path: str = ""
|
||||
for path in paths:
|
||||
self._absolute_path = os.path.join(self._absolute_path, path._absolute_path if isinstance(path, Path) else path)
|
||||
self._absolute_path = os.path.abspath(self._absolute_path)
|
||||
self._name: str = os.path.basename(self._absolute_path)
|
||||
self._dirpath: str = os.path.dirname(self._absolute_path)
|
||||
|
||||
@ -17,6 +19,10 @@ class Path():
|
||||
def get_dirpath(self):
|
||||
return self._dirpath
|
||||
|
||||
def get_site_path(self):
|
||||
site_path: Path = Path(sys.argv[1])
|
||||
return self._absolute_path[len(site_path._absolute_path):]
|
||||
|
||||
def get_absolute_path(self):
|
||||
return self._absolute_path
|
||||
|
||||
@ -25,6 +31,9 @@ class Path():
|
||||
return None
|
||||
return self._name
|
||||
|
||||
def create(self) -> None:
|
||||
os.makedirs(self.get_absolute_path())
|
||||
|
||||
def exist(self) -> bool:
|
||||
return os.path.exists(self.get_absolute_path())
|
||||
|
||||
|
Reference in New Issue
Block a user