# 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
                winreg.CloseKey(gintKey)

                json_done = True

            except WindowsError:

                json_done = False

        elif browser == BROWSER.FIREFOX:
            try:
                # create pdmchromewrapper key under NativeMessagingHosts for firefox
                winreg.CreateKey(winreg.HKEY_CURRENT_USER,
                                 "SOFTWARE\\Mozilla\\NativeMessagingHosts\\com.persepolis.pdmchromewrapper")
                # open a connection to pdmchromewrapper key for firefox
                fintKey = winreg.OpenKey(
                    winreg.HKEY_CURRENT_USER, "SOFTWARE\\Mozilla\\NativeMessagingHosts\\com.persepolis.pdmchromewrapper", 0, winreg.KEY_ALL_ACCESS)
                # set native_message_file as key value
                winreg.SetValueEx(fintKey, '', 0, winreg.REG_SZ, native_message_file)
                # close connection to pdmchromewrapper
                winreg.CloseKey(fintKey)

                json_done = True

            except WindowsError:

                json_done = False

    # create persepolis_run_shell file for gnu/linux and BSD and Mac
    # firefox and chromium and ... call persepolis with Native Messaging system.
    # json file calls persepolis_run_shell file.

# 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

                winreg.CloseKey(gintKey)

                json_done = True

            except WindowsError:

                json_done = False

        elif browser == BROWSER.FIREFOX:
            try:
                # create pdmchromewrapper key under NativeMessagingHosts for firefox
                winreg.CreateKey(winreg.HKEY_CURRENT_USER,
                                 "SOFTWARE\\Mozilla\\NativeMessagingHosts\\com.persepolis.pdmchromewrapper")
                # open a connection to pdmchromewrapper key for firefox
                fintKey = winreg.OpenKey(
                    winreg.HKEY_CURRENT_USER, "SOFTWARE\\Mozilla\\NativeMessagingHosts\\com.persepolis.pdmchromewrapper", 0, winreg.KEY_ALL_ACCESS)
                # set native_message_file as key value
                winreg.SetValueEx(fintKey, '', 0, winreg.REG_SZ, native_message_file)
                # close connection to pdmchromewrapper
                winreg.CloseKey(fintKey)

                json_done = True

            except WindowsError:

                json_done = False

    # create persepolis_run_shell file for gnu/linux and BSD and Mac
    # firefox and chromium and ... call persepolis with Native Messaging system.
    # json file calls persepolis_run_shell file.

    if os_type in (OS.UNIX_LIKE + [OS.OSX]):