HostInterface: Create user directories on startup
This commit is contained in:
parent
b4c06fdcc6
commit
f6fee86f1c
|
@ -53,6 +53,7 @@ static std::string GetRelativePath(const std::string& path, const char* new_file
|
|||
HostInterface::HostInterface()
|
||||
{
|
||||
SetUserDirectory();
|
||||
CreateUserDirectorySubdirectories();
|
||||
m_game_list = std::make_unique<GameList>();
|
||||
m_game_list->SetCacheFilename(GetGameListCacheFileName());
|
||||
m_game_list->SetDatabaseFilename(GetGameListDatabaseFileName());
|
||||
|
@ -464,6 +465,16 @@ void HostInterface::SetUserDirectory()
|
|||
}
|
||||
}
|
||||
|
||||
void HostInterface::CreateUserDirectorySubdirectories()
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("cache").c_str(), false);
|
||||
|
||||
if (!result)
|
||||
ReportError("Failed to create one or more user directories. This may cause issues at runtime.");
|
||||
}
|
||||
|
||||
std::string HostInterface::GetUserDirectoryRelativePath(const char* format, ...) const
|
||||
{
|
||||
std::va_list ap;
|
||||
|
|
|
@ -90,6 +90,9 @@ protected:
|
|||
|
||||
void SetUserDirectory();
|
||||
|
||||
/// Ensures all subdirectories of the user directory are created.
|
||||
void CreateUserDirectorySubdirectories();
|
||||
|
||||
/// Returns the path of the settings file.
|
||||
std::string GetSettingsFileName() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue