1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 17:39:42 +00:00

Pack default CS config

*Technically* it was already being loaded as if it were packed, but it
made no difference because it's supposed to be empty.
This commit is contained in:
AnyOldName3 2021-06-26 20:00:25 +01:00
parent 873b3b4800
commit d38126ef1c
4 changed files with 10 additions and 9 deletions

View file

@ -458,8 +458,8 @@ else ()
"${OpenMW_BINARY_DIR}/openmw.cfg") "${OpenMW_BINARY_DIR}/openmw.cfg")
endif () endif ()
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.cfg pack_resource_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.cfg
"${OpenMW_BINARY_DIR}" "openmw-cs.cfg") "${OpenMW_BINARY_DIR}" "defaults-cs.bin")
# Needs the copy version because the configure version assumes the end of the file has been reached when a null character is reached and there are no CMake expressions to evaluate. # Needs the copy version because the configure version assumes the end of the file has been reached when a null character is reached and there are no CMake expressions to evaluate.
copy_resource_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters copy_resource_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters
@ -928,7 +928,7 @@ elseif(NOT APPLE)
INSTALL(FILES "${INSTALL_SOURCE}/gamecontrollerdb.txt" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw") INSTALL(FILES "${INSTALL_SOURCE}/gamecontrollerdb.txt" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
IF(BUILD_OPENCS) IF(BUILD_OPENCS)
INSTALL(FILES "${INSTALL_SOURCE}/openmw-cs.cfg" DESTINATION "${SYSCONFDIR}" COMPONENT "opencs") INSTALL(FILES "${INSTALL_SOURCE}/defaults-cs.bin" DESTINATION "${SYSCONFDIR}" COMPONENT "opencs")
ENDIF(BUILD_OPENCS) ENDIF(BUILD_OPENCS)
# Install resources # Install resources

View file

@ -158,7 +158,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(APPLE) if(APPLE)
set (OPENCS_MAC_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw-cs.icns") set (OPENCS_MAC_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw-cs.icns")
set (OPENCS_CFG "${OpenMW_BINARY_DIR}/openmw-cs.cfg") set (OPENCS_CFG "${OpenMW_BINARY_DIR}/defaults-cs.bin")
set (OPENCS_DEFAULT_FILTERS_FILE "${OpenMW_BINARY_DIR}/resources/defaultfilters") set (OPENCS_DEFAULT_FILTERS_FILE "${OpenMW_BINARY_DIR}/resources/defaultfilters")
set (OPENCS_OPENMW_CFG "${OpenMW_BINARY_DIR}/openmw.cfg") set (OPENCS_OPENMW_CFG "${OpenMW_BINARY_DIR}/openmw.cfg")
else() else()
@ -270,7 +270,7 @@ if (WIN32)
SET(INSTALL_SOURCE "${OpenMW_BINARY_DIR}") SET(INSTALL_SOURCE "${OpenMW_BINARY_DIR}")
endif () endif ()
INSTALL(FILES "${INSTALL_SOURCE}/openmw-cs.cfg" DESTINATION ".") INSTALL(FILES "${INSTALL_SOURCE}/defaults-cs.bin" DESTINATION ".")
endif() endif()
if (MSVC) if (MSVC)

View file

@ -17,15 +17,15 @@ CSMPrefs::State *CSMPrefs::State::sThis = nullptr;
void CSMPrefs::State::load() void CSMPrefs::State::load()
{ {
// default settings file // default settings file
boost::filesystem::path local = mConfigurationManager.getLocalPath() / mConfigFile; boost::filesystem::path local = mConfigurationManager.getLocalPath() / mDefaultConfigFile;
boost::filesystem::path global = mConfigurationManager.getGlobalPath() / mConfigFile; boost::filesystem::path global = mConfigurationManager.getGlobalPath() / mDefaultConfigFile;
if (boost::filesystem::exists (local)) if (boost::filesystem::exists (local))
mSettings.loadDefault (local.string()); mSettings.loadDefault (local.string());
else if (boost::filesystem::exists (global)) else if (boost::filesystem::exists (global))
mSettings.loadDefault (global.string()); mSettings.loadDefault (global.string());
else else
throw std::runtime_error ("No default settings file found! Make sure the file \"openmw-cs.cfg\" was properly installed."); throw std::runtime_error ("No default settings file found! Make sure the file \"" + mDefaultConfigFile + "\" was properly installed.");
// user settings file // user settings file
boost::filesystem::path user = mConfigurationManager.getUserConfigPath() / mConfigFile; boost::filesystem::path user = mConfigurationManager.getUserConfigPath() / mConfigFile;
@ -641,7 +641,7 @@ void CSMPrefs::State::setDefault (const std::string& key, const std::string& def
} }
CSMPrefs::State::State (const Files::ConfigurationManager& configurationManager) CSMPrefs::State::State (const Files::ConfigurationManager& configurationManager)
: mConfigFile ("openmw-cs.cfg"), mConfigurationManager (configurationManager), : mConfigFile ("openmw-cs.cfg"), mDefaultConfigFile("defaults-cs.bin"), mConfigurationManager (configurationManager),
mCurrentCategory (mCategories.end()) mCurrentCategory (mCategories.end())
{ {
if (sThis) if (sThis)

View file

@ -48,6 +48,7 @@ namespace CSMPrefs
private: private:
const std::string mConfigFile; const std::string mConfigFile;
const std::string mDefaultConfigFile;
const Files::ConfigurationManager& mConfigurationManager; const Files::ConfigurationManager& mConfigurationManager;
ShortcutManager mShortcutManager; ShortcutManager mShortcutManager;
Settings::Manager mSettings; Settings::Manager mSettings;