Beispiel #1
0
    def save_config(self):
        # save the config in appdata.
        f = open(os.path.join(winpaths.get_appdata(), "dotannoy\\config.json"), "w")
        json.dump(self.config, f, sort_keys=True, indent=4, separators=(',', ': '))
        f.flush()

        log.info("Saved {}".format(os.path.join(winpaths.get_appdata(), "dotannoy\\config.json")))
        f.close()
Beispiel #2
0
def getSockDir():
    if sys.platform == 'win32':
        import winpaths
        homedir = winpaths.get_appdata() # = e.g 'C:\ProgramData'
    else:
        homedir = os.path.expanduser("~")
    return homedir
Beispiel #3
0
def set_windows_env_variables(config):
    import winpaths
    config.set('DEFAULT', 'common_app_data_folder',
               winpaths.get_common_appdata())
    config.set('DEFAULT', 'win_local_appdata', winpaths.get_local_appdata())
    config.set('DEFAULT', 'win_appdata', winpaths.get_appdata())
    config.set('DEFAULT', 'win_desktop', winpaths.get_desktop())
    config.set('DEFAULT', 'win_programs', winpaths.get_programs())
    config.set('DEFAULT', 'win_common_admin_tools',
               winpaths.get_common_admin_tools())
    config.set('DEFAULT', 'win_common_documents',
               winpaths.get_common_documents())
    config.set('DEFAULT', 'win_cookies', winpaths.get_cookies())
    config.set('DEFAULT', 'win_history', winpaths.get_history())
    config.set('DEFAULT', 'win_internet_cache', winpaths.get_internet_cache())
    config.set('DEFAULT', 'win_my_pictures', winpaths.get_my_pictures())
    config.set('DEFAULT', 'win_personal', winpaths.get_personal())
    config.set('DEFAULT', 'win_my_documents', winpaths.get_my_documents())
    config.set('DEFAULT', 'win_program_files', winpaths.get_program_files())
    config.set('DEFAULT', 'win_program_files_common',
               winpaths.get_program_files_common())
    config.set('DEFAULT', 'win_system', winpaths.get_system())
    config.set('DEFAULT', 'win_windows', winpaths.get_windows())
    config.set('DEFAULT', 'win_startup', winpaths.get_startup())
    config.set('DEFAULT', 'win_recent', winpaths.get_recent())
Beispiel #4
0
    def load_config(self):
        f = None
        path = os.path.join(winpaths.get_appdata(), "Dotannoy")

        # if the dotannoy folder in appdata doesn't exist, create it
        if not os.path.exists(path):
            os.makedirs(path)

        path = os.path.join(path, "config.json")
        log.info("Checking that {} exists".format(path))

        # if config.json exists, load it
        # if it doesn't, create a default config file
        if os.path.exists(path):
            log.info("Loading config.json")
            f = open(path, "r")
            self.config = json.load(f)
        else:
            log.info("Couldn't find config.json. Creating default config")
            f = open(path, "w")
            default_config = {"steamapps":""}
            json.dump(default_config, f, sort_keys=True, indent=4, separators=(',', ': '))
            self.config = default_config
            f.flush()
        f.close()
Beispiel #5
0
def data_path():
    if not app.is_frozen and app.debug:
        data_path = DATA_PATH_DEBUG
    else:
        data_path = Path(winpaths.get_appdata()) / app.display_name
    if not data_path.exists():
        data_path.mkdir(parents=True, exist_ok=True)
    return data_path
Beispiel #6
0
def _installOpenAlWin():
    appdata = winpaths.get_appdata()
    if not os.path.isfile(appdata + "\\alsoft.ini"):
        shutil.copyfile("other\\alsoft.ini", appdata + "\\alsoft.ini")
    fld = paths.app_data_path('openal')
    if not os.path.isfile(fld + "\\hrtf\\default-44100.mhr"):
        paths.ensure_path(fld + "\\hrtf")
        shutil.copyfile("other\\default-44100.mhr",
                        fld + "\\hrtf\\default-44100.mhr")
Beispiel #7
0
def app_data_path(app_name=None):
	"""Cross-platform method for determining where to put application data."""
	"""Requires the name of the application"""
	if is_windows:
		path = winpaths.get_appdata()
	elif is_mac:
		path = os.path.join(os.path.expanduser('~'), 'Library', 'Application Support')
	elif is_linux:
		path = os.path.expanduser('~')
		app_name = '.%s' % app_name.replace(' ', '_')
	return os.path.join(path, app_name)
Beispiel #8
0
def app_data_path(app_name=None):
    """Cross-platform method for determining where to put application data."""
    """Requires the name of the application"""
    if is_windows:
        path = winpaths.get_appdata()
    elif is_mac:
        path = os.path.join(os.path.expanduser("~"), "Library",
                            "Application Support")
    elif is_linux:
        path = os.path.expanduser("~")
        app_name = ".%s" % app_name.replace(" ", "_")
    return os.path.join(path, app_name)
Beispiel #9
0
def app_data_path(app_name=None):
 """Cross-platform method for determining where to put application data."""
 """Requires the name of the application"""
 plat = platform.system()
 if plat == 'Windows':
  import winpaths
  path = winpaths.get_appdata()
 elif plat == 'Darwin':
  path = os.path.join(os.path.expanduser('~'), 'Library', 'Application Support')
 elif plat == 'Linux':
  path = os.path.expanduser('~')
  app_name = '.%s' % app_name.replace(' ', '_')
 return os.path.join(path, app_name)
Beispiel #10
0
def data_path(app_name='TW blue'):
# if platform.system() == "Windows":
#  import shlobj
#  data_path = os.path.join(shlobj.SHGetFolderPath(0, shlobj.CSIDL_APPDATA), app_name)
# else:
 if platform.system() == "Windows":
  import winpaths
  data_path = os.path.join(winpaths.get_appdata(), app_name)
 else:
  data_path = os.path.join(os.environ['HOME'], ".%s" % app_name)
 if not os.path.exists(data_path):
  os.mkdir(data_path)
 return data_path
Beispiel #11
0
def app_data_path(app_name=None):
	"""Cross-platform method for determining where to put application data."""
	"""Requires the name of the application"""
	plat = platform.system()
	if plat == 'Windows':
		import winpaths
		path = winpaths.get_appdata()
	elif plat == 'Darwin':
		path = os.path.join(os.path.expanduser('~'), 'Library', 'Application Support')
	elif plat == 'Linux':
		path = os.path.expanduser('~')
		app_name = '.%s' % app_name.replace(' ', '_')
	return os.path.join(path, app_name)
Beispiel #12
0
def initialize(appname):
    global settings
    with open(
            os.path.join(winpaths.get_appdata(), 'Montrix', 'MxExcelAddIn',
                         'settings', 'settings.json')) as f:
        settings = json.load(f)

    db_filie = os.path.join(
        settings['GeneralOptionCategory_']['RepositoryDirectory_'], appname,
        'BlobCache', 'userblobs.db')
    #db_filie = os.path.join('C:\\Users\\09928829\\Downloads\\userblobs.db')
    #db_filie = os.path.join('userblobs.db')

    print db_filie + ' load success!'

    global conn
    conn = sqlite3.connect(db_filie)
Beispiel #13
0
    def __init__(self):
        """
        Create the SourceManager.
        The SourceManager is responsible for managing all the different wallpaper sources that live in sources/
        We start by creating the SettingsProvider which is essentially a key-value store for our modules settings.

        If this is created/loaded without a hitch we then load all of our modules one by one.
        """

        self.tpath = os.path.join(winpaths.get_appdata(), "pypaper")
        self.tconvert = os.path.join(self.tpath, "desktop.converted.jpeg")
        if not os.path.isdir(self.tpath):
            os.mkdir(self.tpath)

        self.current_provider = None
        try:
            self.settings = sources.SettingsProvider("settings.db")

        except Exception,e:
            easygui.msgbox("Error creating the settings database: %s"%e)
            sys.exit(1)
Beispiel #14
0
def set_windows_env_variables(config):
    import winpaths
    config.set('DEFAULT', 'common_app_data_folder', winpaths.get_common_appdata())
    config.set('DEFAULT', 'win_local_appdata', winpaths.get_local_appdata())
    config.set('DEFAULT', 'win_appdata', winpaths.get_appdata())
    config.set('DEFAULT', 'win_desktop', winpaths.get_desktop())
    config.set('DEFAULT', 'win_programs', winpaths.get_programs())
    config.set('DEFAULT', 'win_common_admin_tools', winpaths.get_common_admin_tools())
    config.set('DEFAULT', 'win_common_documents', winpaths.get_common_documents())
    config.set('DEFAULT', 'win_cookies', winpaths.get_cookies())
    config.set('DEFAULT', 'win_history', winpaths.get_history())
    config.set('DEFAULT', 'win_internet_cache', winpaths.get_internet_cache())
    config.set('DEFAULT', 'win_my_pictures', winpaths.get_my_pictures())
    config.set('DEFAULT', 'win_personal', winpaths.get_personal())
    config.set('DEFAULT', 'win_my_documents', winpaths.get_my_documents())
    config.set('DEFAULT', 'win_program_files', winpaths.get_program_files())
    config.set('DEFAULT', 'win_program_files_common', winpaths.get_program_files_common())
    config.set('DEFAULT', 'win_system', winpaths.get_system())
    config.set('DEFAULT', 'win_windows', winpaths.get_windows())
    config.set('DEFAULT', 'win_startup', winpaths.get_startup())
    config.set('DEFAULT', 'win_recent', winpaths.get_recent())
def find_miasmata_save():
	import winpaths, os
	return os.path.join(winpaths.get_appdata(),
			'IonFx', 'Miasmata', 'saves.dat')