mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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:
parent
9bfa470581
commit
7056425bbd
@ -45,6 +45,12 @@ namespace dxvk {
|
|||||||
std::ios_base::binary |
|
std::ios_base::binary |
|
||||||
std::ios_base::trunc);
|
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
|
// Write header with the current version number
|
||||||
DxvkStateCacheHeader header;
|
DxvkStateCacheHeader header;
|
||||||
|
|
||||||
@ -455,7 +461,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
std::string DxvkStateCache::getCacheFileName() const {
|
std::string DxvkStateCache::getCacheFileName() const {
|
||||||
std::string path = env::getEnvVar("DXVK_STATE_CACHE_PATH");
|
std::string path = getCacheDir();
|
||||||
|
|
||||||
if (!path.empty() && *path.rbegin() != '/')
|
if (!path.empty() && *path.rbegin() != '/')
|
||||||
path += '/';
|
path += '/';
|
||||||
@ -470,4 +476,9 @@ namespace dxvk {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string DxvkStateCache::getCacheDir() const {
|
||||||
|
return env::getEnvVar("DXVK_STATE_CACHE_PATH");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,8 @@ namespace dxvk {
|
|||||||
void writerFunc();
|
void writerFunc();
|
||||||
|
|
||||||
std::string getCacheFileName() const;
|
std::string getCacheFileName() const;
|
||||||
|
|
||||||
|
std::string getCacheDir() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user