Spaces:
Runtime error
Runtime error
File size: 1,460 Bytes
a8c39f5 f017d24 a8c39f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import sys
import os
now_dir = os.getcwd()
sys.path.append(now_dir)
class InstallationError(Exception):
def __init__(self, message="InstallationError"):
self.message = message
super().__init__(self.message)
def check_installation():
try:
system_drive = os.getenv("SystemDrive", "")
current_drive = os.path.splitdrive(now_dir)[0]
if current_drive.upper() != system_drive.upper():
raise InstallationError(
f"Installation Error: The current working directory is on drive {current_drive}, but the default system drive is {system_drive}. Please move Applio to the {system_drive} drive."
)
except:
pass
else:
if "OneDrive" in now_dir:
raise InstallationError(
"Installation Error: The current working directory is located in OneDrive. Please move Applio to a different folder."
)
elif " " in now_dir:
raise InstallationError(
"Installation Error: The current working directory contains spaces. Please move Applio to a folder without spaces in its path."
)
try:
now_dir.encode("ascii")
except UnicodeEncodeError:
raise InstallationError(
"Installation Error: The current working directory contains non-ASCII characters. Please move Applio to a folder with only ASCII characters in its path."
)
|