mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:40:04 +00:00 
			
		
		
		
	Settings manager fixes for directory creation
This commit is contained in:
		
							parent
							
								
									5214f866d4
								
							
						
					
					
						commit
						5cbe986734
					
				
					 2 changed files with 3 additions and 6 deletions
				
			
		|  | @ -26,28 +26,25 @@ static boost::json::value ConvertSettingsToJson(); | ||||||
| static void               GenerateDefaultSettings(); | static void               GenerateDefaultSettings(); | ||||||
| static bool               LoadSettings(const boost::json::object& settingsJson); | static bool               LoadSettings(const boost::json::object& settingsJson); | ||||||
| 
 | 
 | ||||||
| bool Initialize() | void Initialize() | ||||||
| { | { | ||||||
|    std::string appDataPath { |    std::string appDataPath { | ||||||
|       QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) |       QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) | ||||||
|          .toStdString()}; |          .toStdString()}; | ||||||
| 
 | 
 | ||||||
|    if (!std::filesystem::is_directory(appDataPath)) |    if (!std::filesystem::exists(appDataPath)) | ||||||
|    { |    { | ||||||
|       if (!std::filesystem::create_directories(appDataPath)) |       if (!std::filesystem::create_directories(appDataPath)) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(error) |          BOOST_LOG_TRIVIAL(error) | ||||||
|             << logPrefix_ << "Unable to create application data directory: \"" |             << logPrefix_ << "Unable to create application data directory: \"" | ||||||
|             << appDataPath << "\""; |             << appDataPath << "\""; | ||||||
|          return false; |  | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    std::string settingsPath {appDataPath + "/settings.json"}; |    std::string settingsPath {appDataPath + "/settings.json"}; | ||||||
| 
 | 
 | ||||||
|    ReadSettings(settingsPath); |    ReadSettings(settingsPath); | ||||||
| 
 |  | ||||||
|    return true; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ReadSettings(const std::string& settingsPath) | void ReadSettings(const std::string& settingsPath) | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ namespace manager | ||||||
| namespace SettingsManager | namespace SettingsManager | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| bool Initialize(); | void Initialize(); | ||||||
| void ReadSettings(const std::string& settingsPath); | void ReadSettings(const std::string& settingsPath); | ||||||
| 
 | 
 | ||||||
| std::shared_ptr<settings::GeneralSettings> general_settings(); | std::shared_ptr<settings::GeneralSettings> general_settings(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat