Пример #1
0
def app_main():
    FSGSDirectories.initialize()
    Settings.instance().verbose = False
    Settings.instance().load()
    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())
Пример #2
0
def default_openretro_server_from_file():
    server = None
    p = os.path.join(FSGSDirectories.get_data_dir(), "Settings",
                     "database-server")
    if os.path.exists(p):
        with open(p, "r", encoding="UTF-8") as f:
            server = f.read().strip()
    return server
Пример #3
0
    def get_settings_path(self):
        settings_ini = os.path.join(FSGSDirectories.get_data_dir(),
                                    "Settings.ini")
        if not os.path.exists(settings_ini):
            migrate_list = [
                os.path.join(FSGSDirectories.get_data_dir(),
                             "FS-UAE Launcher.ini")
            ]
            portable_ini = os.path.join(FSGSDirectories.get_base_dir(),
                                        "Portable.ini")
            # move the highest-priority settings file if present
            for migrate in migrate_list:
                if os.path.exists(migrate):
                    shutil.move(migrate, settings_ini)
                    break
            # remove all old settings files
            for migrate in migrate_list:
                if os.path.exists(migrate):
                    os.remove(migrate)

        return settings_ini
 def configure_gus(self, f):
     f.write("\n[gus]\n")
     if self.options[Option.DOSBOX_GUS_GUS].lower() == "true":
         f.write("gus=true\n")
         f.write("ultradir=U:\\ULTRASND\n")
         ultrasnd_drive = os.path.join(self.drives_dir.path, "U")
         source_dir = os.path.join(FSGSDirectories.get_data_dir(),
                                   "ULTRASND")
         dest_dir = os.path.join(ultrasnd_drive, "ULTRASND")
         if os.path.exists(source_dir):
             shutil.copytree(source_dir, dest_dir)
         else:
             # FIXME: ADD ULTRASND WARNING
             pass
    def plugin_path(cls):
        # Plugins dir location has changed, add several old and new paths here
        # to find plugins in both places (FS-UAE and OpenRetro style).

        result = []

        # $BASE/Plugins/ or $BASE/Data/Plugins/
        plugins_dir = FSGSDirectories.get_plugins_dir()
        result.append(plugins_dir)

        # $BASE/Plugins/
        plugins_dir = os.path.join(FSGSDirectories.get_base_dir(), "Plugins")
        if plugins_dir not in result:
            result.append(plugins_dir)

        # $BASE/Data/Plugins/
        plugins_dir = os.path.join(FSGSDirectories.get_data_dir(), "Plugins")
        if plugins_dir not in result:
            result.append(plugins_dir)

        # # $BASE/Workspace/Expansion/
        # plugins_dir = os.path.join(
        #     FSGSDirectories.get_base_dir(), "Workspace", "Expansion"
        # )
        # if plugins_dir and os.path.isdir(plugins_dir):
        #     result.append(plugins_dir)

        if not fsboot.development():
            if System.macos:
                escape_exe_dir = "../../../../../.."
            else:
                escape_exe_dir = "../../.."
            # FIXME: Check that this contains something known first?
            # System/
            plugins_dir = os.path.normpath(
                os.path.join(fsboot.executable_dir(), escape_exe_dir))
            result.append(plugins_dir)

            # FIXME: Check that this contains something known first?
            # System/Plugins/
            plugins_dir = os.path.normpath(
                os.path.join(fsboot.executable_dir(), escape_exe_dir,
                             "Plugins"))
            result.append(plugins_dir)

        return result
    def get_config_files():
        print("get_config_files")
        configs = {}
        input_stream = Resources("fsgamesys").stream("input/manifest.txt")
        print("opened input manifest")
        for line in input_stream.read().split(b"\n"):
            line = line.decode("UTF-8")
            path = line.strip()
            if not path:
                continue
            _, ext = os.path.splitext(path)
            if ext in [".ini", ".conf"]:
                parts = path.split("/")
                file_name = parts[-1]
                name, _ = os.path.splitext(file_name)
                if len(parts) > 1:
                    configs[parts[-2] + "_" + name] = "fsgamesys:input/" + path
                # print(" -", path)
                configs[name] = "fsgamesys:input/" + path

        # FIXME: fix dependency
        controllers_dir = fsgs.amiga.get_controllers_dir()
        print("read configs from controllers_dir at", controllers_dir)
        if os.path.exists(controllers_dir):
            for file_name in os.listdir(controllers_dir):
                if file_name.endswith(".conf"):
                    name, ext = os.path.splitext(file_name)
                    path = os.path.join(controllers_dir, file_name)
                    print(" -", path)
                    configs[name] = path
        keyboards_dir = os.path.join(FSGSDirectories.get_data_dir(), "Devs",
                                     "Keyboards")
        print("read configs from controllers_dir at", keyboards_dir)
        if os.path.exists(keyboards_dir):
            for file_name in os.listdir(keyboards_dir):
                if file_name.endswith(".ini"):
                    name, ext = os.path.splitext(file_name)
                    path = os.path.join(keyboards_dir, file_name)
                    print(" -", path)
                    configs[name] = path

        # print("input config files:", configs)
        return configs
Пример #7
0
def volume_host_path(volume):
    if volume == "data:":
        return FSGSDirectories.get_data_dir()
    elif volume == "amigaforever:":
        return os.path.join(FSGSDirectories.get_base_dir(), "AmigaForever")
    elif volume == "games:":
        return os.path.join(FSGSDirectories.get_base_dir(), "Games")
    elif volume == "media:":
        return os.path.join(FSGSDirectories.get_base_dir(), "Media")
    elif volume == "ram disk:":
        # return os.path.join(FSGSDirectories.get_base_dir(), "Cache")
        return os.path.join(temp_directory())
    elif volume == "shared:":
        # Or ...HardDrives/Shared ?
        return os.path.join(FSGSDirectories.get_base_dir(), "Shared")
    elif volume == "software:":
        return os.path.join(FSGSDirectories.get_base_dir(), "Software")
    elif volume == "whdload:":
        return os.path.join(FSGSDirectories.get_base_dir(), "WHDLoad")
    elif volume == "work:":
        return os.path.join(FSGSDirectories.get_base_dir(), "Work")
    else:
        return None
 def path(self):
     return os.path.join(FSGSDirectories.get_data_dir(), "MAME", "Artwork")
 def path(self):
     return os.path.join(FSGSDirectories.get_data_dir(), "MAME", "Cheats",
                         "cheat.7z")