// ----------------------------------------------------------------------------- // Initialised the ArchiveManager. Finds and opens the program resource archive // ----------------------------------------------------------------------------- bool ArchiveManager::init() { program_resource_archive_ = std::make_unique<ZipArchive>(); #ifdef __WXOSX__ string resdir = App::path("../Resources", App::Dir::Executable); // Use Resources dir within bundle on mac #else string resdir = App::path("res", App::Dir::Executable); #endif if (wxDirExists(resdir) && validResDir(resdir)) { program_resource_archive_->importDir(resdir); res_archive_open_ = (program_resource_archive_->numEntries() > 0); if (!initArchiveFormats()) LOG_MESSAGE(1, "An error occurred reading archive formats configuration"); return res_archive_open_; } // Find slade3.pk3 directory string dir_slade_pk3 = App::path("slade.pk3", App::Dir::Resources); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = App::path("slade.pk3", App::Dir::Data); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = App::path("slade.pk3", App::Dir::Executable); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = App::path("slade.pk3", App::Dir::User); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = "slade.pk3"; // Open slade.pk3 if (!program_resource_archive_->open(dir_slade_pk3)) { LOG_MESSAGE(1, "Unable to find slade.pk3!"); res_archive_open_ = false; } else res_archive_open_ = true; if (!initArchiveFormats()) LOG_MESSAGE(1, "An error occurred reading archive formats configuration"); return res_archive_open_; }
/* ArchiveManager::init * Initialised the ArchiveManager. Finds and opens the program * resource archive *******************************************************************/ bool ArchiveManager::init() { program_resource_archive = new ZipArchive(); #ifdef __WXOSX__ string resdir = appPath("../Resources", DIR_APP); // Use Resources dir within bundle on mac #else string resdir = appPath("res", DIR_APP); #endif if (wxDirExists(resdir) && validResDir(resdir)) { program_resource_archive->importDir(resdir); res_archive_open = (program_resource_archive->numEntries() > 0); return res_archive_open; } // Find slade3.pk3 directory string dir_slade_pk3 = appPath("slade.pk3", DIR_DATA); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = appPath("slade.pk3", DIR_APP); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = appPath("slade.pk3", DIR_USER); if (!wxFileExists(dir_slade_pk3)) dir_slade_pk3 = "slade.pk3"; // Open slade.pk3 if (!program_resource_archive->open(dir_slade_pk3)) { wxLogMessage("Unable to find slade.pk3!"); res_archive_open = false; } else res_archive_open = true; return res_archive_open; }