1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[dxvk] Create state cache directory if it does not yet exist

We only create it if the parent directory already exists. Resolves #907.
This commit is contained in:
Philip Rebohle 2019-02-11 22:24:19 +01:00
parent 9bfa470581
commit 7056425bbd
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 14 additions and 1 deletions

View File

@ -45,6 +45,12 @@ namespace dxvk {
std::ios_base::binary |
std::ios_base::trunc);
if (!file && env::createDirectory(getCacheDir())) {
file = std::ofstream(getCacheFileName(),
std::ios_base::binary |
std::ios_base::trunc);
}
// Write header with the current version number
DxvkStateCacheHeader header;
@ -455,7 +461,7 @@ namespace dxvk {
std::string DxvkStateCache::getCacheFileName() const {
std::string path = env::getEnvVar("DXVK_STATE_CACHE_PATH");
std::string path = getCacheDir();
if (!path.empty() && *path.rbegin() != '/')
path += '/';
@ -470,4 +476,9 @@ namespace dxvk {
return path;
}
std::string DxvkStateCache::getCacheDir() const {
return env::getEnvVar("DXVK_STATE_CACHE_PATH");
}
}

View File

@ -209,6 +209,8 @@ namespace dxvk {
void writerFunc();
std::string getCacheFileName() const;
std::string getCacheDir() const;
};