当前位置: 首页>>代码示例>>Python>>正文


Python FSGSDirectories.get_configurations_dir方法代码示例

本文整理汇总了Python中fsgs.FSGSDirectories.FSGSDirectories.get_configurations_dir方法的典型用法代码示例。如果您正苦于以下问题:Python FSGSDirectories.get_configurations_dir方法的具体用法?Python FSGSDirectories.get_configurations_dir怎么用?Python FSGSDirectories.get_configurations_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fsgs.FSGSDirectories.FSGSDirectories的用法示例。


在下文中一共展示了FSGSDirectories.get_configurations_dir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: app_main

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_configurations_dir [as 别名]
def app_main():
    FSGSDirectories.initialize()
    Settings.instance().load()
    print("")
    print("Directories:")
    print("* base_dir =", FSGSDirectories.get_base_dir())
    print("* cache_dir =", FSGSDirectories.get_cache_dir())
    print("* cdroms_dir =", FSGSDirectories.get_cdroms_dir())
    print("* configurations_dir =", FSGSDirectories.get_configurations_dir())
    print("* controllers_dir =", FSGSDirectories.get_controllers_dir())
    print("* covers_dir =", FSGSDirectories.get_covers_dir())
    print("* data_dir =", FSGSDirectories.get_data_dir())
    print("* downloads_dir =", FSGSDirectories.downloads_dir())
    print("* floppies_dir =", FSGSDirectories.get_floppies_dir())
    print("* hard_drives_dir =", FSGSDirectories.get_hard_drives_dir())
    # print("* images_dir =", FSGSDirectories.get_images_dir())
    print("* kickstarts_dir =", FSGSDirectories.get_kickstarts_dir())
    print("* launcher_dir =", FSGSDirectories.get_launcher_dir())
    print("* logs_dir =", FSGSDirectories.get_logs_dir())
    print("* plugins_dir =", FSGSDirectories.get_plugins_dir())
    # print("* portable_dir =", FSGSDirectories.portable_dir())
    print("* save_states_dir =", FSGSDirectories.get_save_states_dir())
    print("* screenshots_dir =", FSGSDirectories.get_screenshots_dir())
    print("* screenshots_output_dir =", FSGSDirectories.screenshots_output_dir())
    print("* themes_dir =", FSGSDirectories.get_themes_dir())
    print("* titles_dir =", FSGSDirectories.get_titles_dir())
    print("* whdload_dir =", FSGSDirectories.get_whdload_dir())
    print("")
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:30,代码来源:list_dirs.py

示例2: config_startup_scan

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_configurations_dir [as 别名]
    def config_startup_scan(cls):
        if cls._config_scanned:
            return
        cls._config_scanned = True

        configs_dir = FSGSDirectories.get_configurations_dir()
        print("config_startup_scan", configs_dir)
        print(LauncherSettings.settings)

        settings_mtime = LauncherSettings.get("configurations_dir_mtime")
        dir_mtime = cls.get_dir_mtime_str(configs_dir)
        if settings_mtime == dir_mtime + "+" + str(Database.VERSION):
            print("... mtime not changed", settings_mtime, dir_mtime)
            return

        database = Database.get_instance()
        file_database = FileDatabase.get_instance()

        print("... database.find_local_configurations")
        local_configs = Database.get_instance().find_local_configurations()
        print("... walk configs_dir")
        for dir_path, dir_names, file_names in os.walk(configs_dir):
            for file_name in file_names:
                if not file_name.endswith(".fs-uae"):
                    continue
                path = Paths.join(dir_path, file_name)
                if path in local_configs:
                    local_configs[path] = None
                    # already exists in database
                    continue
                name, ext = os.path.splitext(file_name)
                # search = ConfigurationScanner.create_configuration_search(
                # name)
                scanner = ConfigurationScanner()
                print("[startup] adding config", path)
                file_database.delete_file(path=path)
                with open(path, "rb") as f:
                    sha1 = hashlib.sha1(f.read()).hexdigest()
                file_database.add_file(path=path, sha1=sha1)

                game_id = database.add_configuration(
                    path=path, name=scanner.create_configuration_name(name)
                )
                database.update_game_search_terms(
                    game_id, scanner.create_search_terms(name)
                )

        for path, config_id in local_configs.items():
            if config_id is not None:
                print("[startup] removing configuration", path)
                database.delete_game(id=config_id)
                file_database.delete_file(path=path)
        print("... commit")
        database.commit()

        LauncherSettings.set(
            "configurations_dir_mtime",
            cls.get_dir_mtime_str(configs_dir) + "+" + str(Database.VERSION),
        )
开发者ID:,项目名称:,代码行数:61,代码来源:

示例3: get_search_path

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_configurations_dir [as 别名]
 def get_search_path(cls):
     paths = FSGSDirectories.get_default_search_path()
     search_path = LauncherSettings.get("search_path")
     for p in search_path.split(";"):
         p = p.strip()
         if not p:
             continue
         elif p[0] == "-":
             p = p[1:]
             if p in paths:
                 paths.remove(p)
         else:
             if p not in paths:
                 paths.append(p)
     # The Configurations dir is always scanned on startup (whenever
     # modification time has changed). If we don't include it here too
     # always, the result will be that the configs sometimes appear (on
     # startup) and disappear (on scan).
     if not FSGSDirectories.get_configurations_dir() in paths:
         paths.append(FSGSDirectories.get_configurations_dir())
     # Likewise, we force the Kickstarts directory to always be scanned.
     if not FSGSDirectories.get_kickstarts_dir() in paths:
         paths.append(FSGSDirectories.get_kickstarts_dir())
     return paths
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:26,代码来源:scan_paths_group.py

示例4: save_config

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_configurations_dir [as 别名]
    def save_config():
        print("SaveButton.save_config")
        database = Database.get_instance()

        name = LauncherSettings.get("config_name").strip()
        if not name:
            print("no config_name")
            # FIXME: notify user
            return

        file_name = name + ".fs-uae"
        path = os.path.join(
            FSGSDirectories.get_configurations_dir(), file_name)
        with io.open(path, "w", encoding="UTF-8") as f:
            f.write("# FS-UAE configuration saved by FS-UAE Launcher\n")
            f.write("# Last saved: {0}\n".format(
                    datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
            f.write("\n[fs-uae]\n")
            keys = sorted(fsgs.config.values.keys())
            for key in keys:
                value = LauncherConfig.get(key)
                if key.startswith("__"):
                    continue
                if key in LauncherConfig.no_save_keys_set:
                    continue
                # elif key == "joystick_port_2_mode" and value == "nothing":
                #     continue
                # elif key == "joystick_port_3_mode" and value == "nothing":
                #     continue
                if value == LauncherConfig.default_config.get(key, ""):
                    continue
                if value:
                    f.write("{0} = {1}\n".format(key, value))

        # scanner = ConfigurationScanner()
        # search = ConfigurationScanner.create_configuration_search(name)
        # name = scanner.create_configuration_name(name)
        # print("adding", path)
        # # deleting the path from the database first in case it already exists
        # database.delete_configuration(path=path)
        # database.delete_file(path=path)
        # database.add_file(path=path)
        # database.add_configuration(
        #     path=path, uuid="", name=name, scan=0, search=search)

        file_database = FileDatabase.get_instance()
        scanner = ConfigurationScanner()
        print("[save config] adding config", path)
        file_database.delete_file(path=path)
        with open(path, "rb") as f:
            sha1 = hashlib.sha1(f.read()).hexdigest()
        file_database.add_file(path=path, sha1=sha1)

        game_id = database.add_game(
            path=path, name=scanner.create_configuration_name(name))
        database.update_game_search_terms(
            game_id, scanner.create_search_terms(name))

        database.commit()
        file_database.commit()

        LauncherSettings.set("__config_refresh", str(time.time()))
        # Settings.set("config_changed", "0")
        LauncherConfig.set("__changed", "0")
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:66,代码来源:savebutton.py


注:本文中的fsgs.FSGSDirectories.FSGSDirectories.get_configurations_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。