File size: 1,291 Bytes
4efe6b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"Error: Current working directory is not on the default system drive ({system_drive}). Please move Applio in the correct drive."
            )
    except:
        pass
    else:
        if "OneDrive" in now_dir:
            raise InstallationError(
                "Error: Current working directory is on OneDrive. Please move Applio in another folder."
            )
        elif " " in now_dir:
            raise InstallationError(
                "Error: Current working directory contains spaces. Please move Applio in another folder."
            )
        try:
            now_dir.encode("ascii")
        except UnicodeEncodeError:
            raise InstallationError(
                "Error: Current working directory contains non-ASCII characters. Please move Applio in another folder."
            )