# Path: persepolis/scripts/useful_tools.py
# def determineConfigFolder():
#     if os_type in OS.UNIX_LIKE:
#         config_folder = os.path.join(
#             home_address, ".config/persepolis_download_manager")
#     elif os_type == OS.OSX:
#         config_folder = os.path.join(
#             home_address, "Library/Application Support/persepolis_download_manager")
#     elif os_type == OS.WINDOWS:
#         config_folder = os.path.join(
#             home_address, 'AppData', 'Local', 'persepolis_download_manager')
# 
#     return config_folder
# 
# Path: persepolis/scripts/osCommands.py
# def findFileManager():
# def touch(file_path):
# def xdgOpen(file_path, f_type='file', path='file'):
# def remove(file_path): 
# def removeDir(folder_path):
# def makeDirs(folder_path, hidden=False):
# def findMountPoint(path):
# def makeTempDownloadDir(path):
# def moveFile(old_file_path, new_path, new_path_type='folder'):
#         CREATE_NO_WINDOW = 0x08000000
#             CREATE_NO_WINDOW = 0x08000000
# 
# Path: persepolis/constants/Os.py
# class OS:
#     LINUX = 'Linux'
#     WINDOWS = 'Windows'
#     FREE_BSD = 'FreeBSD'
#     OPEN_BSD = 'OpenBSD'
#     OSX = DARWIN = 'Darwin'
#     BSD_FAMILY = [FREE_BSD, OPEN_BSD]
#     UNIX_LIKE = BSD_FAMILY + [LINUX]
#     LIST = [LINUX, WINDOWS, FREE_BSD, OPEN_BSD, OSX]
# 
# Path: persepolis/constants/Browser.py
# class BROWSER:
#     CHROME = 'chrome'
#     CHROMIUM = 'chromium'
#     OPERA = 'opera'
#     VIVALDI = 'vivaldi'
#     FIREFOX = 'firefox'
#     BRAVE = 'brave'
#     CHROME_FAMILY = [CHROME, CHROMIUM, VIVALDI, OPERA, BRAVE]
#     LIST = [CHROME, CHROMIUM, OPERA, VIVALDI, FIREFOX, BRAVE]


from persepolis.scripts.useful_tools import determineConfigFolder
from persepolis.scripts import osCommands
from persepolis.constants import OS, BROWSER
import subprocess
import platform
import sys
import os
        import winreg
            current_directory, 'Persepolis Download Manager.exe')

        # the execution path in json file for Windows must in form of
        # c:\\Users\\...\\Persepolis Download Manager.exe , so we need 2
        # "\" in address
        exec_path = exec_path.replace('\\', r'\\')

        if browser in BROWSER.CHROME_FAMILY:
            native_message_folder = os.path.join(
                home_address, 'AppData\Local\persepolis_download_manager', 'chrome')
        else:
            native_message_folder = os.path.join(
                home_address, 'AppData\Local\persepolis_download_manager', 'firefox')

    # WebExtension native hosts file prototype
    webextension_json_connector = {
        "name": "com.persepolis.pdmchromewrapper",
        "type": "stdio",
        "path": str(exec_path),
        "description": "Integrate Persepolis with %s using WebExtensions" % (browser)
    }

    # Add chrom* keys
    if browser in BROWSER.CHROME_FAMILY:
        webextension_json_connector["allowed_origins"] = ["chrome-extension://legimlagjjoghkoedakdjhocbeomojao/"]

    # Add firefox keys
    elif browser == BROWSER.FIREFOX:
        webextension_json_connector["allowed_extensions"] = [
            "com.persepolis.pdmchromewrapper@persepolisdm.github.io",

# Path: persepolis/scripts/useful_tools.py
# def determineConfigFolder():
#     if os_type in OS.UNIX_LIKE:
#         config_folder = os.path.join(
#             home_address, ".config/persepolis_download_manager")
#     elif os_type == OS.OSX:
#         config_folder = os.path.join(
#             home_address, "Library/Application Support/persepolis_download_manager")
#     elif os_type == OS.WINDOWS:
#         config_folder = os.path.join(
#             home_address, 'AppData', 'Local', 'persepolis_download_manager')
# 
#     return config_folder
# 
# Path: persepolis/scripts/osCommands.py
# def findFileManager():
# def touch(file_path):
# def xdgOpen(file_path, f_type='file', path='file'):
# def remove(file_path): 
# def removeDir(folder_path):
# def makeDirs(folder_path, hidden=False):
# def findMountPoint(path):
# def makeTempDownloadDir(path):
# def moveFile(old_file_path, new_path, new_path_type='folder'):
#         CREATE_NO_WINDOW = 0x08000000
#             CREATE_NO_WINDOW = 0x08000000
# 
# Path: persepolis/constants/Os.py
# class OS:
#     LINUX = 'Linux'
#     WINDOWS = 'Windows'
#     FREE_BSD = 'FreeBSD'
#     OPEN_BSD = 'OpenBSD'
#     OSX = DARWIN = 'Darwin'
#     BSD_FAMILY = [FREE_BSD, OPEN_BSD]
#     UNIX_LIKE = BSD_FAMILY + [LINUX]
#     LIST = [LINUX, WINDOWS, FREE_BSD, OPEN_BSD, OSX]
# 
# Path: persepolis/constants/Browser.py
# class BROWSER:
#     CHROME = 'chrome'
#     CHROMIUM = 'chromium'
#     OPERA = 'opera'
#     VIVALDI = 'vivaldi'
#     FIREFOX = 'firefox'
#     BRAVE = 'brave'
#     CHROME_FAMILY = [CHROME, CHROMIUM, VIVALDI, OPERA, BRAVE]
#     LIST = [CHROME, CHROMIUM, OPERA, VIVALDI, FIREFOX, BRAVE]


# Path: persepolis/scripts/browser_integration.py
from persepolis.scripts.useful_tools import determineConfigFolder
from persepolis.scripts import osCommands
from persepolis.constants import OS, BROWSER
import subprocess
import platform
import sys
import os
        import winreg

            current_directory, 'Persepolis Download Manager.exe')

        # the execution path in json file for Windows must in form of
        # c:\\Users\\...\\Persepolis Download Manager.exe , so we need 2
        # "\" in address
        exec_path = exec_path.replace('\\', r'\\')

        if browser in BROWSER.CHROME_FAMILY:
            native_message_folder = os.path.join(
                home_address, 'AppData\Local\persepolis_download_manager', 'chrome')
        else:
            native_message_folder = os.path.join(
                home_address, 'AppData\Local\persepolis_download_manager', 'firefox')

    # WebExtension native hosts file prototype
    webextension_json_connector = {
        "name": "com.persepolis.pdmchromewrapper",
        "type": "stdio",
        "path": str(exec_path),
        "description": "Integrate Persepolis with %s using WebExtensions" % (browser)
    }

    # Add chrom* keys
    if browser in BROWSER.CHROME_FAMILY:
        webextension_json_connector["allowed_origins"] = ["chrome-extension://legimlagjjoghkoedakdjhocbeomojao/"]

    # Add firefox keys
    elif browser == BROWSER.FIREFOX:
        webextension_json_connector["allowed_extensions"] = [
            "com.persepolis.pdmchromewrapper@persepolisdm.github.io",

            "com.persepolis.pdmchromewrapper.offline@persepolisdm.github.io"