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:
parent
9bfa470581
commit
7056425bbd
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ namespace dxvk {
|
||||
void writerFunc();
|
||||
|
||||
std::string getCacheFileName() const;
|
||||
|
||||
std::string getCacheDir() const;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user