From c226da6172926ce30f6b9efb946a53296da7d32d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 26 Apr 2015 17:27:36 +0200 Subject: [PATCH] BeOS: support for vmdir preferences. --- BasiliskII/src/BeOS/main_beos.cpp | 4 +++- BasiliskII/src/BeOS/prefs_beos.cpp | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/BasiliskII/src/BeOS/main_beos.cpp b/BasiliskII/src/BeOS/main_beos.cpp index c8e19287..507e3bde 100644 --- a/BasiliskII/src/BeOS/main_beos.cpp +++ b/BasiliskII/src/BeOS/main_beos.cpp @@ -118,6 +118,8 @@ private: class file_open_error {}; class file_read_error {}; class rom_size_error {}; + + char* vmdir; }; static BasiliskII *the_app; @@ -178,7 +180,7 @@ void BasiliskII::ReadyToRun(void) // Read preferences int argc = 0; char **argv = NULL; - PrefsInit(argc, argv); + PrefsInit(vmdir, argc, argv); // Init system routines SysInit(); diff --git a/BasiliskII/src/BeOS/prefs_beos.cpp b/BasiliskII/src/BeOS/prefs_beos.cpp index 556ed284..9a74d643 100644 --- a/BasiliskII/src/BeOS/prefs_beos.cpp +++ b/BasiliskII/src/BeOS/prefs_beos.cpp @@ -44,8 +44,23 @@ static BPath prefs_path; * Load preferences from settings file */ -void LoadPrefs(void) +void LoadPrefs(const char* vmdir) { +#if 0 + if (vmdir) { + prefs_path.SetTo(vmdir); + prefs_path.Append("prefs"); + FILE *prefs = fopen(prefs_path.Path(), "r"); + if (!prefs) { + printf("No file at %s found.\n", prefs_path.Path()); + exit(1); + } + LoadPrefsFromStream(prefs); + fclose(prefs); + return; + } +#endif + // Construct prefs path find_directory(B_USER_SETTINGS_DIRECTORY, &prefs_path, true); prefs_path.Append(PREFS_FILE_NAME);