Is there a valid use case for setting the env var to a directory which doesn't exist?
I don't really like messing around with file system functions for no good reason, especially since the C++ standard library does not provide any such functions, and using Win32 functions correctly is hard. In other words, the current behaviour is intended.
Is there a valid use case for setting the env var to a directory which doesn't exist?
Yes, I want to put DXVK state cache in ~/.cache directory (like mesa_shader_cache does). I'm using that:
export DXVK_STATE_CACHE_PATH="$HOME/.cache/dxvk"
Generally, others software put things in cache directory without that I need to create a subdirectory manually.
I don't really like messing around with file system functions for no good reason, especially since the C++ standard library does not provide any such functions [...]. In other words, the current behaviour is intended.
I understand.
However, C++17 provides such functions, like std::filesystem::exists and std::filesystem::create_directory. What do you thing about using C++17?
Yes, I want to put DXVK state cache in
~/.cachedirectory
I guess that's convincing enough, will probably implement it then.
What do you thing about using C++17?
I'm already using C++17 language features, but using the standard library features is currently not an option since DXVK has to support a bunch of old compilers, unfortunately.
Edit: Also, <filesystem> appears to be broken in MinGW 6.0.
If you were to use Win32 funcs:
CreateDirectory[A/W] is usually good enough, but it functions like mkdir and not mkdir -p
You'd also have to try and make every directory (or check before making) along the way to that dir in order for it to work properly.
Shlwapi has some nice helper functions for this (and its what I see a few games use), but its another dependency and a bit of a hacky solution. Using std string find and going through may be a better solution.
The thing that bothers me about CreateDirectoryW is that we need to convert char sets again, which wouldn't be necessary if <filesystem> worked (honestly I can't wait for it to become usable), and that can potentially go wrong if not done correctly.
But yeah, that will have to do. mkdir -p behaviour shouldn't be necessary and might be too invasive anyway.
Thank you, it works as expected since v1.0. :ok_hand:
DXVK_STATE_CACHE_PATH="$HOME/.cache/dxvk"x1 2019-02DXVK_STATE_CACHE_PATHx1 2019-02
When I set
DXVK_STATE_CACHE_PATHenvironment variable, theDXVK_STATE_CACHE_PATHdirectory is not created, so DXVK state cache is disabled.After creating
DXVK_STATE_CACHE_PATHdirectory manually, DXVK state cache works as expected.DXVK should check if
DXVK_STATE_CACHE_PATHdirectory exists and make it if it does not exist.System information