Use std::filesystem instead of custom fs::path
Removes code and makes the codebase more understandable (by not
introducing weird behavior unique to fs::path).
Replaces a lot of the bespoke logic to handle string<->wstring due
to using std::filesystem::path.
diff --git a/tests/framework/README.md b/tests/framework/README.md
index 7ae04c2..1dc5b73 100644
--- a/tests/framework/README.md
+++ b/tests/framework/README.md
@@ -136,7 +136,6 @@
* Environment Variable Wrapper: `EnvVarWrapper` for creating, setting, getting, and removing environment variables in a RAII manner
* Windows API error handling helpers
* filesystem abstractions:
- * `fs::path` - wrapper around std::string that has a similar API to C++17's `filesystem::path` library
* `create_folder`/`delete_folder`
* `FolderManager`
* Creates a new folder with the given name at construction time.
diff --git a/tests/framework/icd/test_icd.h b/tests/framework/icd/test_icd.h
index d0a5a96..6290af3 100644
--- a/tests/framework/icd/test_icd.h
+++ b/tests/framework/icd/test_icd.h
@@ -75,7 +75,7 @@
// clang-format on
struct TestICD {
- fs::path manifest_file_path;
+ std::filesystem::path manifest_file_path;
BUILDER_VALUE(TestICD, bool, exposes_vk_icdNegotiateLoaderICDInterfaceVersion, true)
BUILDER_VALUE(TestICD, bool, exposes_vkEnumerateInstanceExtensionProperties, true)
diff --git a/tests/framework/layer/test_layer.h b/tests/framework/layer/test_layer.h
index 322bf9e..72855ca 100644
--- a/tests/framework/layer/test_layer.h
+++ b/tests/framework/layer/test_layer.h
@@ -89,7 +89,7 @@
using FP_layer_callback = VkResult (*)(TestLayer& layer, void* data);
struct TestLayer {
- fs::path manifest_file_path;
+ std::filesystem::path manifest_file_path;
uint32_t manifest_version = VK_MAKE_API_VERSION(0, 1, 1, 2);
BUILDER_VALUE(TestLayer, bool, is_meta_layer, false)
diff --git a/tests/framework/shim/shim.h b/tests/framework/shim/shim.h
index f259d43..46d7f88 100644
--- a/tests/framework/shim/shim.h
+++ b/tests/framework/shim/shim.h
@@ -59,9 +59,9 @@
struct RegistryEntry {
RegistryEntry() = default;
- RegistryEntry(std::string const& name) noexcept : name(name) {}
- RegistryEntry(std::string const& name, DWORD value) noexcept : name(name), value(value) {}
- std::string name;
+ RegistryEntry(std::filesystem::path const& name) noexcept : name(name) {}
+ RegistryEntry(std::filesystem::path const& name, DWORD value) noexcept : name(name), value(value) {}
+ std::filesystem::path name;
DWORD value{};
};
@@ -102,9 +102,9 @@
};
struct D3DKMT_Adapter {
- D3DKMT_Adapter& add_driver_manifest_path(fs::path const& src);
- D3DKMT_Adapter& add_implicit_layer_manifest_path(fs::path const& src);
- D3DKMT_Adapter& add_explicit_layer_manifest_path(fs::path const& src);
+ D3DKMT_Adapter& add_driver_manifest_path(std::filesystem::path const& src);
+ D3DKMT_Adapter& add_implicit_layer_manifest_path(std::filesystem::path const& src);
+ D3DKMT_Adapter& add_explicit_layer_manifest_path(std::filesystem::path const& src);
UINT hAdapter;
LUID adapter_luid;
@@ -113,7 +113,7 @@
std::vector<std::wstring> explicit_layer_paths;
private:
- D3DKMT_Adapter& add_path(fs::path src, std::vector<std::wstring>& dest);
+ D3DKMT_Adapter& add_path(std::filesystem::path src, std::vector<std::wstring>& dest);
};
#elif COMMON_UNIX_PLATFORMS
@@ -143,18 +143,18 @@
// Test Framework interface
void reset();
- void redirect_all_paths(fs::path const& path);
- void redirect_category(fs::path const& new_path, ManifestCategory category);
+ void redirect_all_paths(std::filesystem::path const& path);
+ void redirect_category(std::filesystem::path const& new_path, ManifestCategory category);
// fake paths are paths that the loader normally looks in but actually point to locations inside the test framework
- void set_fake_path(ManifestCategory category, fs::path const& path);
+ void set_fake_path(ManifestCategory category, std::filesystem::path const& path);
// known paths are real paths but since the test framework guarantee's the order files are found in, files in these paths
// need to be ordered correctly
- void add_known_path(fs::path const& path);
+ void add_known_path(std::filesystem::path const& path);
- void add_manifest(ManifestCategory category, fs::path const& path);
- void add_unsecured_manifest(ManifestCategory category, fs::path const& path);
+ void add_manifest(ManifestCategory category, std::filesystem::path const& path);
+ void add_unsecured_manifest(ManifestCategory category, std::filesystem::path const& path);
// platform specific shim interface
#if defined(WIN32)
@@ -164,20 +164,20 @@
void add_dxgi_adapter(GpuType gpu_preference, DXGI_ADAPTER_DESC1 desc1);
void add_d3dkmt_adapter(D3DKMT_Adapter const& adapter);
- void set_app_package_path(fs::path const& path);
+ void set_app_package_path(std::filesystem::path const& path);
std::unordered_map<uint32_t, DXGIAdapter> dxgi_adapters;
std::vector<D3DKMT_Adapter> d3dkmt_adapters;
// TODO:
- void add_CM_Device_ID(std::wstring const& id, fs::path const& icd_path, fs::path const& layer_path);
+ void add_CM_Device_ID(std::wstring const& id, std::filesystem::path const& icd_path, std::filesystem::path const& layer_path);
std::wstring CM_device_ID_list = {L'\0'};
std::vector<RegistryEntry> CM_device_ID_registry_keys;
uint32_t random_base_path = 0;
- std::vector<fs::path> icd_paths;
+ std::vector<std::filesystem::path> icd_paths;
std::vector<RegistryEntry> hkey_current_user_explicit_layers;
std::vector<RegistryEntry> hkey_current_user_implicit_layers;
@@ -194,22 +194,22 @@
std::vector<HKeyHandle> created_keys;
#elif COMMON_UNIX_PLATFORMS
- bool is_fake_path(fs::path const& path);
- fs::path const& get_real_path_from_fake_path(fs::path const& path);
+ bool is_fake_path(std::filesystem::path const& path);
+ std::filesystem::path const& get_real_path_from_fake_path(std::filesystem::path const& path);
- void redirect_path(fs::path const& path, fs::path const& new_path);
- void remove_redirect(fs::path const& path);
+ void redirect_path(std::filesystem::path const& path, std::filesystem::path const& new_path);
+ void remove_redirect(std::filesystem::path const& path);
- bool is_known_path(fs::path const& path);
- void remove_known_path(fs::path const& path);
+ bool is_known_path(std::filesystem::path const& path);
+ void remove_known_path(std::filesystem::path const& path);
- void redirect_dlopen_name(fs::path const& filename, fs::path const& actual_path);
- bool is_dlopen_redirect_name(fs::path const& filename);
+ void redirect_dlopen_name(std::filesystem::path const& filename, std::filesystem::path const& actual_path);
+ bool is_dlopen_redirect_name(std::filesystem::path const& filename);
- fs::path query_default_redirect_path(ManifestCategory category);
+ std::filesystem::path query_default_redirect_path(ManifestCategory category);
- std::unordered_map<std::string, fs::path> redirection_map;
- std::unordered_map<std::string, fs::path> dlopen_redirection_map;
+ std::unordered_map<std::string, std::filesystem::path> redirection_map;
+ std::unordered_map<std::string, std::filesystem::path> dlopen_redirection_map;
std::unordered_set<std::string> known_path_set;
void set_elevated_privilege(bool elev) { use_fake_elevation = elev; }
@@ -227,7 +227,8 @@
std::vector<std::string> parse_env_var_list(std::string const& var);
std::string category_path_name(ManifestCategory category);
-std::vector<std::string> get_folder_contents(std::vector<fs::FolderManager>* folders, std::string folder_name) noexcept;
+std::vector<std::filesystem::path> get_folder_contents(std::vector<fs::FolderManager>* folders,
+ std::filesystem::path folder_name) noexcept;
extern "C" {
// dynamically link on windows and macos
diff --git a/tests/framework/shim/shim_common.cpp b/tests/framework/shim/shim_common.cpp
index 8fe7aa0..df5c552 100644
--- a/tests/framework/shim/shim_common.cpp
+++ b/tests/framework/shim/shim_common.cpp
@@ -29,7 +29,7 @@
#include <random>
-void PlatformShim::redirect_all_paths(fs::path const& path) {
+void PlatformShim::redirect_all_paths(std::filesystem::path const& path) {
redirect_category(path, ManifestCategory::implicit_layer);
redirect_category(path, ManifestCategory::explicit_layer);
redirect_category(path, ManifestCategory::icd);
@@ -60,7 +60,8 @@
return items;
}
-std::vector<std::string> get_folder_contents(std::vector<fs::FolderManager>* folders, std::string folder_name) noexcept {
+std::vector<std::filesystem::path> get_folder_contents(std::vector<fs::FolderManager>* folders,
+ std::filesystem::path folder_name) noexcept {
for (auto& folder : *folders) {
if (folder.location() == folder_name) {
return folder.get_files();
@@ -71,19 +72,16 @@
#if defined(WIN32)
-D3DKMT_Adapter& D3DKMT_Adapter::add_driver_manifest_path(fs::path const& src) { return add_path(src, driver_paths); }
-D3DKMT_Adapter& D3DKMT_Adapter::add_implicit_layer_manifest_path(fs::path const& src) {
+D3DKMT_Adapter& D3DKMT_Adapter::add_driver_manifest_path(std::filesystem::path const& src) { return add_path(src, driver_paths); }
+D3DKMT_Adapter& D3DKMT_Adapter::add_implicit_layer_manifest_path(std::filesystem::path const& src) {
return add_path(src, implicit_layer_paths);
}
-D3DKMT_Adapter& D3DKMT_Adapter::add_explicit_layer_manifest_path(fs::path const& src) {
+D3DKMT_Adapter& D3DKMT_Adapter::add_explicit_layer_manifest_path(std::filesystem::path const& src) {
return add_path(src, explicit_layer_paths);
}
-D3DKMT_Adapter& D3DKMT_Adapter::add_path(fs::path src, std::vector<std::wstring>& dest) {
- std::wstring dest_path;
- dest_path.resize(src.size());
- MultiByteToWideChar(CP_UTF8, 0, src.c_str(), static_cast<int>(src.size()), &dest_path[0], static_cast<int>(dest_path.size()));
- dest.push_back(dest_path);
+D3DKMT_Adapter& D3DKMT_Adapter::add_path(std::filesystem::path src, std::vector<std::wstring>& dest) {
+ dest.push_back(src.native());
return *this;
}
@@ -105,28 +103,28 @@
hkey_current_user_settings.clear();
}
-void PlatformShim::set_fake_path([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {}
-void PlatformShim::add_known_path([[maybe_unused]] fs::path const& path) {}
+void PlatformShim::set_fake_path([[maybe_unused]] ManifestCategory category, [[maybe_unused]] std::filesystem::path const& path) {}
+void PlatformShim::add_known_path([[maybe_unused]] std::filesystem::path const& path) {}
-void PlatformShim::add_manifest(ManifestCategory category, fs::path const& path) {
+void PlatformShim::add_manifest(ManifestCategory category, std::filesystem::path const& path) {
if (category == ManifestCategory::settings) {
- hkey_local_machine_settings.emplace_back(path.str());
+ hkey_local_machine_settings.emplace_back(path);
} else if (category == ManifestCategory::implicit_layer) {
- hkey_local_machine_implicit_layers.emplace_back(path.str());
+ hkey_local_machine_implicit_layers.emplace_back(path);
} else if (category == ManifestCategory::explicit_layer) {
- hkey_local_machine_explicit_layers.emplace_back(path.str());
+ hkey_local_machine_explicit_layers.emplace_back(path);
} else {
- hkey_local_machine_drivers.emplace_back(path.str());
+ hkey_local_machine_drivers.emplace_back(path);
}
}
-void PlatformShim::add_unsecured_manifest(ManifestCategory category, fs::path const& path) {
+void PlatformShim::add_unsecured_manifest(ManifestCategory category, std::filesystem::path const& path) {
if (category == ManifestCategory::settings) {
- hkey_current_user_settings.emplace_back(path.str());
+ hkey_current_user_settings.emplace_back(path);
} else if (category == ManifestCategory::implicit_layer) {
- hkey_current_user_implicit_layers.emplace_back(path.str());
+ hkey_current_user_implicit_layers.emplace_back(path);
} else if (category == ManifestCategory::explicit_layer) {
- hkey_current_user_explicit_layers.emplace_back(path.str());
+ hkey_current_user_explicit_layers.emplace_back(path);
}
}
@@ -137,14 +135,11 @@
void PlatformShim::add_d3dkmt_adapter(D3DKMT_Adapter const& adapter) { d3dkmt_adapters.push_back(adapter); }
-void PlatformShim::set_app_package_path(fs::path const& path) {
- app_package_path.resize(path.size());
- MultiByteToWideChar(CP_UTF8, 0, path.c_str(), -1, &app_package_path[0], static_cast<int>(app_package_path.size()));
-}
+void PlatformShim::set_app_package_path(std::filesystem::path const& path) { app_package_path = path; }
// TODO:
-void PlatformShim::add_CM_Device_ID([[maybe_unused]] std::wstring const& id, [[maybe_unused]] fs::path const& icd_path,
- [[maybe_unused]] fs::path const& layer_path) {
+void PlatformShim::add_CM_Device_ID([[maybe_unused]] std::wstring const& id, [[maybe_unused]] std::filesystem::path const& icd_path,
+ [[maybe_unused]] std::filesystem::path const& layer_path) {
// // append a null byte as separator if there is already id's in the list
// if (CM_device_ID_list.size() != 0) {
// CM_device_ID_list += L'\0'; // I'm sure this wont cause issues with std::string down the line... /s
@@ -163,7 +158,7 @@
// // add_key_value_string(id_key, "VulkanLayerName", layer_path.c_str());
}
-void PlatformShim::redirect_category(fs::path const&, ManifestCategory) {}
+void PlatformShim::redirect_category(std::filesystem::path const&, ManifestCategory) {}
#elif COMMON_UNIX_PLATFORMS
@@ -181,34 +176,39 @@
void PlatformShim::reset() { redirection_map.clear(); }
-bool PlatformShim::is_fake_path(fs::path const& path) { return redirection_map.count(path.str()) > 0; }
-fs::path const& PlatformShim::get_real_path_from_fake_path(fs::path const& path) { return redirection_map.at(path.str()); }
-void PlatformShim::redirect_path(fs::path const& path, fs::path const& new_path) { redirection_map[path.str()] = new_path; }
-void PlatformShim::remove_redirect(fs::path const& path) { redirection_map.erase(path.str()); }
+bool PlatformShim::is_fake_path(std::filesystem::path const& path) { return redirection_map.count(path) > 0; }
+std::filesystem::path const& PlatformShim::get_real_path_from_fake_path(std::filesystem::path const& path) {
+ return redirection_map.at(path);
+}
+void PlatformShim::redirect_path(std::filesystem::path const& path, std::filesystem::path const& new_path) {
+ redirection_map[path] = new_path;
+}
+void PlatformShim::remove_redirect(std::filesystem::path const& path) { redirection_map.erase(path); }
-bool PlatformShim::is_known_path(fs::path const& path) { return known_path_set.count(path.str()) > 0; }
-void PlatformShim::add_known_path(fs::path const& path) { known_path_set.insert(path.str()); }
-void PlatformShim::remove_known_path(fs::path const& path) { known_path_set.erase(path.str()); }
+bool PlatformShim::is_known_path(std::filesystem::path const& path) { return known_path_set.count(path) > 0; }
+void PlatformShim::add_known_path(std::filesystem::path const& path) { known_path_set.insert(path); }
+void PlatformShim::remove_known_path(std::filesystem::path const& path) { known_path_set.erase(path); }
-void PlatformShim::add_manifest([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {}
-void PlatformShim::add_unsecured_manifest([[maybe_unused]] ManifestCategory category, [[maybe_unused]] fs::path const& path) {}
+void PlatformShim::add_manifest([[maybe_unused]] ManifestCategory category, [[maybe_unused]] std::filesystem::path const& path) {}
+void PlatformShim::add_unsecured_manifest([[maybe_unused]] ManifestCategory category,
+ [[maybe_unused]] std::filesystem::path const& path) {}
void parse_and_add_env_var_override(std::vector<std::string>& paths, std::string env_var_contents) {
auto parsed_paths = parse_env_var_list(env_var_contents);
paths.insert(paths.end(), parsed_paths.begin(), parsed_paths.end());
}
-void PlatformShim::redirect_category(fs::path const& new_path, ManifestCategory category) {
+void PlatformShim::redirect_category(std::filesystem::path const& new_path, ManifestCategory category) {
std::vector<std::string> paths;
- auto home = fs::path(get_env_var("HOME"));
+ auto home = std::filesystem::path(get_env_var("HOME"));
if (category == ManifestCategory::settings) {
redirect_path(home / ".local/share/vulkan" / category_path_name(category), new_path);
return;
}
- if (home.size() != 0) {
- paths.push_back((home / ".config").str());
- paths.push_back((home / ".local/share").str());
+ if (!home.empty()) {
+ paths.push_back((home / ".config"));
+ paths.push_back((home / ".local/share"));
}
// Don't report errors on apple - these env-vars are not suppose to be defined
bool report_errors = true;
@@ -237,23 +237,25 @@
for (auto& path : paths) {
if (!path.empty()) {
- redirect_path(fs::path(path) / "vulkan" / category_path_name(category), new_path);
+ redirect_path(std::filesystem::path(path) / "vulkan" / category_path_name(category), new_path);
}
}
}
-void PlatformShim::set_fake_path(ManifestCategory category, fs::path const& path) {
+void PlatformShim::set_fake_path(ManifestCategory category, std::filesystem::path const& path) {
// use /etc as the 'redirection path' by default since its always searched
- redirect_path(fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category), path);
+ redirect_path(std::filesystem::path(SYSCONFDIR) / "vulkan" / category_path_name(category), path);
}
-void PlatformShim::redirect_dlopen_name(fs::path const& filename, fs::path const& actual_path) {
- dlopen_redirection_map[filename.str()] = actual_path;
+void PlatformShim::redirect_dlopen_name(std::filesystem::path const& filename, std::filesystem::path const& actual_path) {
+ dlopen_redirection_map[filename] = actual_path;
}
-bool PlatformShim::is_dlopen_redirect_name(fs::path const& filename) { return dlopen_redirection_map.count(filename.str()) == 1; }
+bool PlatformShim::is_dlopen_redirect_name(std::filesystem::path const& filename) {
+ return dlopen_redirection_map.count(filename) == 1;
+}
-fs::path PlatformShim::query_default_redirect_path(ManifestCategory category) {
- return fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category);
+std::filesystem::path PlatformShim::query_default_redirect_path(ManifestCategory category) {
+ return std::filesystem::path(SYSCONFDIR) / "vulkan" / category_path_name(category);
}
#endif
diff --git a/tests/framework/shim/unix_shim.cpp b/tests/framework/shim/unix_shim.cpp
index 52b02c6..4f82eec 100644
--- a/tests/framework/shim/unix_shim.cpp
+++ b/tests/framework/shim/unix_shim.cpp
@@ -135,7 +135,7 @@
}
DIR* dir;
if (platform_shim.is_fake_path(path_name)) {
- auto real_path_name = platform_shim.get_real_path_from_fake_path(fs::path(path_name));
+ auto real_path_name = platform_shim.get_real_path_from_fake_path(std::filesystem::path(path_name));
dir = real_opendir(real_path_name.c_str());
platform_shim.dir_entries.push_back(DirEntry{dir, std::string(path_name), {}, 0, true});
} else if (platform_shim.is_known_path(path_name)) {
@@ -175,7 +175,7 @@
}
auto real_path = it->folder_path;
if (it->is_fake_path) {
- real_path = platform_shim.redirection_map.at(it->folder_path).str();
+ real_path = platform_shim.redirection_map.at(it->folder_path);
}
auto filenames = get_folder_contents(platform_shim.folders, real_path);
@@ -215,13 +215,13 @@
#if !defined(__APPLE__)
if (!real_access) real_access = (PFN_ACCESS)dlsym(RTLD_NEXT, "access");
#endif
- fs::path path{in_pathname};
+ std::filesystem::path path{in_pathname};
if (!path.has_parent_path()) {
return real_access(in_pathname, mode);
}
if (platform_shim.is_fake_path(path.parent_path())) {
- fs::path real_path = platform_shim.get_real_path_from_fake_path(path.parent_path());
+ std::filesystem::path real_path = platform_shim.get_real_path_from_fake_path(path.parent_path());
real_path /= path.filename();
return real_access(real_path.c_str(), mode);
}
@@ -232,7 +232,7 @@
#if !defined(__APPLE__)
if (!real_fopen) real_fopen = (PFN_FOPEN)dlsym(RTLD_NEXT, "fopen");
#endif
- fs::path path{in_filename};
+ std::filesystem::path path{in_filename};
if (!path.has_parent_path()) {
return real_fopen(in_filename, mode);
}
diff --git a/tests/framework/shim/windows_shim.cpp b/tests/framework/shim/windows_shim.cpp
index 10fd0e3..6f59dc6 100644
--- a/tests/framework/shim/windows_shim.cpp
+++ b/tests/framework/shim/windows_shim.cpp
@@ -326,12 +326,13 @@
const auto &location = *location_ptr;
if (dwIndex >= location.size()) return ERROR_NO_MORE_ITEMS;
- if (*lpcchValueName < location[dwIndex].name.size()) return ERROR_NO_MORE_ITEMS;
- for (size_t i = 0; i < location[dwIndex].name.size(); i++) {
- lpValueName[i] = location[dwIndex].name[i];
+ std::string name = narrow(location[dwIndex].name);
+ if (*lpcchValueName < name.size()) return ERROR_NO_MORE_ITEMS;
+ for (size_t i = 0; i < name.size(); i++) {
+ lpValueName[i] = name[i];
}
- lpValueName[location[dwIndex].name.size()] = '\0';
- *lpcchValueName = static_cast<DWORD>(location[dwIndex].name.size() + 1);
+ lpValueName[name.size()] = '\0';
+ *lpcchValueName = static_cast<DWORD>(name.size() + 1);
if (*lpcbData < sizeof(DWORD)) return ERROR_NO_MORE_ITEMS;
DWORD *lpcbData_dword = reinterpret_cast<DWORD *>(lpData);
*lpcbData_dword = location[dwIndex].value;
diff --git a/tests/framework/test_environment.cpp b/tests/framework/test_environment.cpp
index ea92868..ddd989f 100644
--- a/tests/framework/test_environment.cpp
+++ b/tests/framework/test_environment.cpp
@@ -27,11 +27,11 @@
#include "test_environment.h"
-fs::path get_loader_path() {
- auto loader_path = fs::path(FRAMEWORK_VULKAN_LIBRARY_PATH);
+std::filesystem::path get_loader_path() {
+ auto loader_path = std::filesystem::path(FRAMEWORK_VULKAN_LIBRARY_PATH);
auto env_var_res = get_env_var("VK_LOADER_TEST_LOADER_PATH", false);
if (!env_var_res.empty()) {
- loader_path = fs::path(env_var_res);
+ loader_path = std::filesystem::path(env_var_res);
}
return loader_path;
}
@@ -356,7 +356,7 @@
PlatformShimWrapper::~PlatformShimWrapper() noexcept { platform_shim->reset(); }
TestICDHandle::TestICDHandle() noexcept {}
-TestICDHandle::TestICDHandle(fs::path const& icd_path) noexcept : icd_library(icd_path) {
+TestICDHandle::TestICDHandle(std::filesystem::path const& icd_path) noexcept : icd_library(icd_path) {
proc_addr_get_test_icd = icd_library.get_symbol(GET_TEST_ICD_FUNC_STR);
proc_addr_reset_icd = icd_library.get_symbol(RESET_ICD_FUNC_STR);
}
@@ -368,12 +368,12 @@
assert(proc_addr_reset_icd != NULL && "symbol must be loaded before use");
return *proc_addr_reset_icd();
}
-fs::path TestICDHandle::get_icd_full_path() noexcept { return icd_library.lib_path; }
-fs::path TestICDHandle::get_icd_manifest_path() noexcept { return manifest_path; }
-fs::path TestICDHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; }
+std::filesystem::path TestICDHandle::get_icd_full_path() noexcept { return icd_library.lib_path; }
+std::filesystem::path TestICDHandle::get_icd_manifest_path() noexcept { return manifest_path; }
+std::filesystem::path TestICDHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; }
TestLayerHandle::TestLayerHandle() noexcept {}
-TestLayerHandle::TestLayerHandle(fs::path const& layer_path) noexcept : layer_library(layer_path) {
+TestLayerHandle::TestLayerHandle(std::filesystem::path const& layer_path) noexcept : layer_library(layer_path) {
proc_addr_get_test_layer = layer_library.get_symbol(GET_TEST_LAYER_FUNC_STR);
proc_addr_reset_layer = layer_library.get_symbol(RESET_LAYER_FUNC_STR);
}
@@ -385,9 +385,9 @@
assert(proc_addr_reset_layer != NULL && "symbol must be loaded before use");
return *proc_addr_reset_layer();
}
-fs::path TestLayerHandle::get_layer_full_path() noexcept { return layer_library.lib_path; }
-fs::path TestLayerHandle::get_layer_manifest_path() noexcept { return manifest_path; }
-fs::path TestLayerHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; }
+std::filesystem::path TestLayerHandle::get_layer_full_path() noexcept { return layer_library.lib_path; }
+std::filesystem::path TestLayerHandle::get_layer_manifest_path() noexcept { return manifest_path; }
+std::filesystem::path TestLayerHandle::get_shimmed_manifest_path() noexcept { return shimmed_manifest_path; }
FrameworkEnvironment::FrameworkEnvironment() noexcept : FrameworkEnvironment(FrameworkSettings{}) {}
FrameworkEnvironment::FrameworkEnvironment(FrameworkSettings const& settings) noexcept
@@ -470,42 +470,44 @@
folder = &get_folder(ManifestLocation::null);
}
if (!icd_details.is_fake) {
- fs::path new_driver_name = fs::path(icd_details.icd_manifest.lib_path).stem() + "_" + std::to_string(cur_icd_index) +
- fs::path(icd_details.icd_manifest.lib_path).extension();
-
- auto new_driver_location = folder->copy_file(icd_details.icd_manifest.lib_path, new_driver_name.str());
+ std::filesystem::path new_lib_name = icd_details.icd_manifest.lib_path.stem();
+ new_lib_name += "_";
+ new_lib_name += std::to_string(cur_icd_index);
+ new_lib_name += icd_details.icd_manifest.lib_path.extension();
+ auto new_driver_location = folder->copy_file(icd_details.icd_manifest.lib_path, new_lib_name);
#if COMMON_UNIX_PLATFORMS
if (icd_details.library_path_type == LibraryPathType::default_search_paths) {
- platform_shim->redirect_dlopen_name(new_driver_name, new_driver_location);
+ platform_shim->redirect_dlopen_name(new_lib_name, new_driver_location);
} else if (icd_details.library_path_type == LibraryPathType::relative) {
- platform_shim->redirect_dlopen_name(fs::path(SYSCONFDIR) / "vulkan" / "icd.d" / "." / new_driver_name,
+ platform_shim->redirect_dlopen_name(std::filesystem::path(SYSCONFDIR) / "vulkan" / "icd.d" / "." / new_lib_name,
new_driver_location);
}
#endif
#if defined(WIN32)
if (icd_details.library_path_type == LibraryPathType::default_search_paths) {
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS);
- AddDllDirectory(conver_str_to_wstr(new_driver_location.parent_path().str()).c_str());
+ AddDllDirectory(new_driver_location.parent_path().native().c_str());
}
#endif
icds.push_back(TestICDHandle(new_driver_location));
icds.back().reset_icd();
if (icd_details.library_path_type == LibraryPathType::relative) {
- icd_details.icd_manifest.lib_path = fs::path(".") / new_driver_name;
+ icd_details.icd_manifest.lib_path = std::filesystem::path(".") / new_lib_name;
} else if (icd_details.library_path_type == LibraryPathType::default_search_paths) {
- icd_details.icd_manifest.lib_path = new_driver_name.str();
+ icd_details.icd_manifest.lib_path = new_lib_name;
} else {
- icd_details.icd_manifest.lib_path = new_driver_location.str();
+ icd_details.icd_manifest.lib_path = new_driver_location;
}
}
if (icd_details.discovery_type != ManifestDiscoveryType::none) {
- std::string full_json_name = icd_details.json_name;
+ std::filesystem::path new_manifest_path = icd_details.json_name.stem();
if (!icd_details.disable_icd_inc) {
- full_json_name += "_" + std::to_string(cur_icd_index);
+ new_manifest_path += "_";
+ new_manifest_path += std::to_string(cur_icd_index);
}
- full_json_name += ".json";
- icds.back().manifest_path = folder->write_manifest(full_json_name, icd_details.icd_manifest.get_manifest_str());
+ new_manifest_path += ".json";
+ icds.back().manifest_path = folder->write_manifest(new_manifest_path, icd_details.icd_manifest.get_manifest_str());
icds.back().shimmed_manifest_path = icds.back().manifest_path;
switch (icd_details.discovery_type) {
default:
@@ -513,22 +515,22 @@
platform_shim->add_manifest(ManifestCategory::icd, icds.back().manifest_path);
#if COMMON_UNIX_PLATFORMS
icds.back().shimmed_manifest_path =
- platform_shim->query_default_redirect_path(ManifestCategory::icd) / full_json_name;
+ platform_shim->query_default_redirect_path(ManifestCategory::icd) / new_manifest_path;
#endif
break;
case (ManifestDiscoveryType::env_var):
if (icd_details.is_dir) {
- env_var_vk_icd_filenames.add_to_list(folder->location().str());
+ env_var_vk_icd_filenames.add_to_list(narrow(folder->location()));
} else {
- env_var_vk_icd_filenames.add_to_list((folder->location() / full_json_name).str());
+ env_var_vk_icd_filenames.add_to_list(narrow(folder->location() / new_manifest_path));
}
platform_shim->add_known_path(folder->location());
break;
case (ManifestDiscoveryType::add_env_var):
if (icd_details.is_dir) {
- add_env_var_vk_icd_filenames.add_to_list(folder->location().str());
+ add_env_var_vk_icd_filenames.add_to_list(narrow(folder->location()));
} else {
- add_env_var_vk_icd_filenames.add_to_list((folder->location() / full_json_name).str());
+ add_env_var_vk_icd_filenames.add_to_list(narrow(folder->location() / new_manifest_path));
}
platform_shim->add_known_path(folder->location());
break;
@@ -579,18 +581,18 @@
case (ManifestDiscoveryType::env_var):
fs_ptr = &get_folder(ManifestLocation::explicit_layer_env_var);
if (layer_details.is_dir) {
- env_var_vk_layer_paths.add_to_list(fs_ptr->location().str());
+ env_var_vk_layer_paths.add_to_list(narrow(fs_ptr->location()));
} else {
- env_var_vk_layer_paths.add_to_list((fs_ptr->location() / layer_details.json_name).str());
+ env_var_vk_layer_paths.add_to_list(narrow(fs_ptr->location() / layer_details.json_name));
}
platform_shim->add_known_path(fs_ptr->location());
break;
case (ManifestDiscoveryType::add_env_var):
fs_ptr = &get_folder(ManifestLocation::explicit_layer_add_env_var);
if (layer_details.is_dir) {
- add_env_var_vk_layer_paths.add_to_list(fs_ptr->location().str());
+ add_env_var_vk_layer_paths.add_to_list(narrow(fs_ptr->location()));
} else {
- add_env_var_vk_layer_paths.add_to_list((fs_ptr->location() / layer_details.json_name).str());
+ add_env_var_vk_layer_paths.add_to_list(narrow(fs_ptr->location() / layer_details.json_name));
}
platform_shim->add_known_path(fs_ptr->location());
break;
@@ -614,39 +616,43 @@
auto& folder = *fs_ptr;
size_t new_layers_start = layers.size();
for (auto& layer : layer_details.layer_manifest.layers) {
- if (!layer.lib_path.str().empty()) {
- fs::path layer_binary_name =
- layer.lib_path.filename().stem() + "_" + std::to_string(layers.size()) + layer.lib_path.filename().extension();
+ if (!layer.lib_path.empty()) {
+ std::filesystem::path new_lib_path = layer.lib_path.stem();
+ new_lib_path += "_";
+ new_lib_path += std::to_string(layers.size());
+ new_lib_path += layer.lib_path.extension();
- auto new_layer_location = folder.copy_file(layer.lib_path, layer_binary_name.str());
+ auto new_layer_location = folder.copy_file(layer.lib_path, new_lib_path);
#if COMMON_UNIX_PLATFORMS
if (layer_details.library_path_type == LibraryPathType::default_search_paths) {
- platform_shim->redirect_dlopen_name(layer_binary_name, new_layer_location);
+ platform_shim->redirect_dlopen_name(new_lib_path, new_layer_location);
}
if (layer_details.library_path_type == LibraryPathType::relative) {
platform_shim->redirect_dlopen_name(
- fs::path(SYSCONFDIR) / "vulkan" / category_path_name(category) / "." / layer_binary_name, new_layer_location);
+ std::filesystem::path(SYSCONFDIR) / "vulkan" / category_path_name(category) / "." / new_lib_path,
+ new_layer_location);
}
#endif
#if defined(WIN32)
if (layer_details.library_path_type == LibraryPathType::default_search_paths) {
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS);
- AddDllDirectory(conver_str_to_wstr(new_layer_location.parent_path().str()).c_str());
+ AddDllDirectory(new_layer_location.parent_path().native().c_str());
}
#endif
// Don't load the layer binary if using any of the wrap objects layers, since it doesn't export the same interface
// functions
if (!layer_details.is_fake &&
- layer.lib_path.stem().str().find(fs::path(TEST_LAYER_WRAP_OBJECTS).stem().str()) == std::string::npos) {
+ layer.lib_path.stem().string().find(std::filesystem::path(TEST_LAYER_WRAP_OBJECTS).stem().string()) ==
+ std::string::npos) {
layers.push_back(TestLayerHandle(new_layer_location));
layers.back().reset_layer();
}
if (layer_details.library_path_type == LibraryPathType::relative) {
- layer.lib_path = fs::path(".") / layer_binary_name;
+ layer.lib_path = std::filesystem::path(".") / new_lib_path;
} else if (layer_details.library_path_type == LibraryPathType::default_search_paths) {
- layer.lib_path = layer_binary_name;
+ layer.lib_path = new_lib_path;
} else {
layer.lib_path = new_layer_location;
}
@@ -706,7 +712,7 @@
for (const auto& config : setting.layer_configurations) {
writer.StartObject();
writer.AddKeyedString("name", config.name);
- writer.AddKeyedString("path", fs::fixup_backslashes_in_path(config.path));
+ writer.AddKeyedString("path", escape_backslashes_for_json(config.path));
writer.AddKeyedString("control", config.control);
writer.AddKeyedBool("treat_as_implicit_manifest", config.treat_as_implicit_manifest);
writer.EndObject();
@@ -767,17 +773,23 @@
TestICD& FrameworkEnvironment::get_test_icd(size_t index) noexcept { return icds[index].get_test_icd(); }
TestICD& FrameworkEnvironment::reset_icd(size_t index) noexcept { return icds[index].reset_icd(); }
-fs::path FrameworkEnvironment::get_test_icd_path(size_t index) noexcept { return icds[index].get_icd_full_path(); }
-fs::path FrameworkEnvironment::get_icd_manifest_path(size_t index) noexcept { return icds[index].get_icd_manifest_path(); }
-fs::path FrameworkEnvironment::get_shimmed_icd_manifest_path(size_t index) noexcept {
+std::filesystem::path FrameworkEnvironment::get_test_icd_path(size_t index) noexcept { return icds[index].get_icd_full_path(); }
+std::filesystem::path FrameworkEnvironment::get_icd_manifest_path(size_t index) noexcept {
+ return icds[index].get_icd_manifest_path();
+}
+std::filesystem::path FrameworkEnvironment::get_shimmed_icd_manifest_path(size_t index) noexcept {
return icds[index].get_shimmed_manifest_path();
}
TestLayer& FrameworkEnvironment::get_test_layer(size_t index) noexcept { return layers[index].get_test_layer(); }
TestLayer& FrameworkEnvironment::reset_layer(size_t index) noexcept { return layers[index].reset_layer(); }
-fs::path FrameworkEnvironment::get_test_layer_path(size_t index) noexcept { return layers[index].get_layer_full_path(); }
-fs::path FrameworkEnvironment::get_layer_manifest_path(size_t index) noexcept { return layers[index].get_layer_manifest_path(); }
-fs::path FrameworkEnvironment::get_shimmed_layer_manifest_path(size_t index) noexcept {
+std::filesystem::path FrameworkEnvironment::get_test_layer_path(size_t index) noexcept {
+ return layers[index].get_layer_full_path();
+}
+std::filesystem::path FrameworkEnvironment::get_layer_manifest_path(size_t index) noexcept {
+ return layers[index].get_layer_manifest_path();
+}
+std::filesystem::path FrameworkEnvironment::get_shimmed_layer_manifest_path(size_t index) noexcept {
return layers[index].get_shimmed_manifest_path();
}
@@ -790,7 +802,7 @@
}
#if defined(__APPLE__)
void FrameworkEnvironment::setup_macos_bundle() noexcept {
- platform_shim->bundle_contents = get_folder(ManifestLocation::macos_bundle).location().str();
+ platform_shim->bundle_contents = get_folder(ManifestLocation::macos_bundle).location();
}
#endif
diff --git a/tests/framework/test_environment.h b/tests/framework/test_environment.h
index 1be4e48..3167f03 100644
--- a/tests/framework/test_environment.h
+++ b/tests/framework/test_environment.h
@@ -478,7 +478,7 @@
struct LoaderSettingsLayerConfiguration {
BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, name, {})
- BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, path, {})
+ BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::filesystem::path, path, {})
BUILDER_VALUE(LoaderSettingsLayerConfiguration, std::string, control, {})
BUILDER_VALUE(LoaderSettingsLayerConfiguration, bool, treat_as_implicit_manifest, false)
};
@@ -529,35 +529,39 @@
struct TestICDHandle {
TestICDHandle() noexcept;
- TestICDHandle(fs::path const& icd_path) noexcept;
+ TestICDHandle(std::filesystem::path const& icd_path) noexcept;
TestICD& reset_icd() noexcept;
TestICD& get_test_icd() noexcept;
- fs::path get_icd_full_path() noexcept;
- fs::path get_icd_manifest_path() noexcept;
- fs::path get_shimmed_manifest_path() noexcept;
+ std::filesystem::path get_icd_full_path() noexcept;
+ std::filesystem::path get_icd_manifest_path() noexcept;
+ std::filesystem::path get_shimmed_manifest_path() noexcept;
// Must use statically
LibraryWrapper icd_library;
GetTestICDFunc proc_addr_get_test_icd = nullptr;
GetNewTestICDFunc proc_addr_reset_icd = nullptr;
- fs::path manifest_path; // path to the manifest file is on the actual filesystem (aka <build_folder>/tests/framework/<...>)
- fs::path shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>)
+ std::filesystem::path
+ manifest_path; // path to the manifest file is on the actual filesystem (aka <build_folder>/tests/framework/<...>)
+ std::filesystem::path
+ shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>)
};
struct TestLayerHandle {
TestLayerHandle() noexcept;
- TestLayerHandle(fs::path const& layer_path) noexcept;
+ TestLayerHandle(std::filesystem::path const& layer_path) noexcept;
TestLayer& reset_layer() noexcept;
TestLayer& get_test_layer() noexcept;
- fs::path get_layer_full_path() noexcept;
- fs::path get_layer_manifest_path() noexcept;
- fs::path get_shimmed_manifest_path() noexcept;
+ std::filesystem::path get_layer_full_path() noexcept;
+ std::filesystem::path get_layer_manifest_path() noexcept;
+ std::filesystem::path get_shimmed_manifest_path() noexcept;
// Must use statically
LibraryWrapper layer_library;
GetTestLayerFunc proc_addr_get_test_layer = nullptr;
GetNewTestLayerFunc proc_addr_reset_layer = nullptr;
- fs::path manifest_path; // path to the manifest file is on the actual filesystem (aka <build_folder>/tests/framework/<...>)
- fs::path shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>)
+ std::filesystem::path
+ manifest_path; // path to the manifest file is on the actual filesystem (aka <build_folder>/tests/framework/<...>)
+ std::filesystem::path
+ shimmed_manifest_path; // path to where the loader will find the manifest file (eg /usr/local/share/vulkan/<...>)
};
// Controls whether to create a manifest and where to put it
@@ -581,11 +585,11 @@
struct TestICDDetails {
TestICDDetails(ManifestICD icd_manifest) noexcept : icd_manifest(icd_manifest) {}
- TestICDDetails(fs::path icd_binary_path, uint32_t api_version = VK_API_VERSION_1_0) noexcept {
- icd_manifest.set_lib_path(icd_binary_path.str()).set_api_version(api_version);
+ TestICDDetails(std::filesystem::path icd_binary_path, uint32_t api_version = VK_API_VERSION_1_0) noexcept {
+ icd_manifest.set_lib_path(icd_binary_path).set_api_version(api_version);
}
BUILDER_VALUE(TestICDDetails, ManifestICD, icd_manifest, {});
- BUILDER_VALUE(TestICDDetails, std::string, json_name, "test_icd");
+ BUILDER_VALUE(TestICDDetails, std::filesystem::path, json_name, "test_icd");
// Uses the json_name without modification - default is to append _1 in the json file to distinguish drivers
BUILDER_VALUE(TestICDDetails, bool, disable_icd_inc, false);
BUILDER_VALUE(TestICDDetails, ManifestDiscoveryType, discovery_type, ManifestDiscoveryType::generic);
@@ -655,15 +659,15 @@
TestICD& get_test_icd(size_t index = 0) noexcept;
TestICD& reset_icd(size_t index = 0) noexcept;
- fs::path get_test_icd_path(size_t index = 0) noexcept;
- fs::path get_icd_manifest_path(size_t index = 0) noexcept;
- fs::path get_shimmed_icd_manifest_path(size_t index = 0) noexcept;
+ std::filesystem::path get_test_icd_path(size_t index = 0) noexcept;
+ std::filesystem::path get_icd_manifest_path(size_t index = 0) noexcept;
+ std::filesystem::path get_shimmed_icd_manifest_path(size_t index = 0) noexcept;
TestLayer& get_test_layer(size_t index = 0) noexcept;
TestLayer& reset_layer(size_t index = 0) noexcept;
- fs::path get_test_layer_path(size_t index = 0) noexcept;
- fs::path get_layer_manifest_path(size_t index = 0) noexcept;
- fs::path get_shimmed_layer_manifest_path(size_t index = 0) noexcept;
+ std::filesystem::path get_test_layer_path(size_t index = 0) noexcept;
+ std::filesystem::path get_layer_manifest_path(size_t index = 0) noexcept;
+ std::filesystem::path get_shimmed_layer_manifest_path(size_t index = 0) noexcept;
fs::FolderManager& get_folder(ManifestLocation location) noexcept;
fs::FolderManager const& get_folder(ManifestLocation location) const noexcept;
diff --git a/tests/framework/test_util.cpp b/tests/framework/test_util.cpp
index 6952a48..509779f 100644
--- a/tests/framework/test_util.cpp
+++ b/tests/framework/test_util.cpp
@@ -28,6 +28,7 @@
#include "test_util.h"
#if defined(WIN32)
+#include <wchar.h>
#include <strsafe.h>
const char* win_api_error_str(LSTATUS status) {
if (status == ERROR_INVALID_FUNCTION) return "ERROR_INVALID_FUNCTION";
@@ -113,8 +114,16 @@
void print_vector_of_strings(JsonWriter& writer, const char* object_name, std::vector<std::string> const& strings) {
if (strings.size() == 0) return;
writer.StartKeyedArray(object_name);
- for (auto& str : strings) {
- writer.AddString(fs::fixup_backslashes_in_path(str));
+ for (auto const& str : strings) {
+ writer.AddString(escape_backslashes_for_json(str));
+ }
+ writer.EndArray();
+}
+void print_vector_of_strings(JsonWriter& writer, const char* object_name, std::vector<std::filesystem::path> const& paths) {
+ if (paths.size() == 0) return;
+ writer.StartKeyedArray(object_name);
+ for (auto const& path : paths) {
+ writer.AddString(escape_backslashes_for_json(path));
}
writer.EndArray();
}
@@ -126,7 +135,7 @@
writer.StartObject();
writer.AddKeyedString("file_format_version", file_format_version.get_version_str());
writer.StartKeyedObject("ICD");
- writer.AddKeyedString("library_path", fs::fixup_backslashes_in_path(lib_path).str());
+ writer.AddKeyedString("library_path", escape_backslashes_for_json(lib_path));
writer.AddKeyedString("api_version", version_to_string(api_version));
writer.AddKeyedBool("is_portability_driver", is_portability_driver);
if (!library_arch.empty()) writer.AddKeyedString("library_arch", library_arch);
@@ -147,8 +156,8 @@
void ManifestLayer::LayerDescription::get_manifest_str(JsonWriter& writer) const {
writer.AddKeyedString("name", name);
writer.AddKeyedString("type", get_type_str(type));
- if (!lib_path.str().empty()) {
- writer.AddKeyedString("library_path", fs::fixup_backslashes_in_path(lib_path.str()));
+ if (!lib_path.empty()) {
+ writer.AddKeyedString("library_path", escape_backslashes_for_json(lib_path));
}
writer.AddKeyedString("api_version", version_to_string(api_version));
writer.AddKeyedString("implementation_version", std::to_string(implementation_version));
@@ -206,30 +215,8 @@
return writer.output;
}
-namespace fs {
-std::string make_native(std::string const& in_path) {
- std::string out;
-#if defined(WIN32)
- for (auto& c : in_path) {
- if (c == '/')
- out += "\\";
- else
- out += c;
- }
-#elif COMMON_UNIX_PLATFORMS
- for (size_t i = 0; i < in_path.size(); i++) {
- if (i + 1 < in_path.size() && in_path[i] == '\\' && in_path[i + 1] == '\\') {
- out += '/';
- i++;
- } else
- out += in_path[i];
- }
-#endif
- return out;
-}
-
// Json doesn't allow `\` in strings, it must be escaped. Thus we have to convert '\\' to '\\\\' in strings
-std::string fixup_backslashes_in_path(std::string const& in_path) {
+std::string escape_backslashes_for_json(std::string const& in_path) {
std::string out;
for (auto& c : in_path) {
if (c == '\\')
@@ -239,137 +226,38 @@
}
return out;
}
-fs::path fixup_backslashes_in_path(fs::path const& in_path) { return fixup_backslashes_in_path(in_path.str()); }
-
-path& path::operator+=(path const& in) {
- contents += in.contents;
- return *this;
+std::string escape_backslashes_for_json(std::filesystem::path const& in_path) {
+ return escape_backslashes_for_json(narrow(in_path.native()));
}
-path& path::operator+=(std::string const& in) {
- contents += in;
- return *this;
-}
-path& path::operator+=(const char* in) {
- contents += std::string{in};
- return *this;
-}
-path& path::operator/=(path const& in) {
- if (contents.back() != path_separator && in.contents.front() != path_separator) contents += path_separator;
- contents += in.contents;
- return *this;
-}
-path& path::operator/=(std::string const& in) {
- if (contents.back() != path_separator && in.front() != path_separator) contents += path_separator;
- contents += in;
- return *this;
-}
-path& path::operator/=(const char* in) {
- std::string in_str{in};
- if (contents.back() != path_separator && in_str.front() != path_separator) contents += path_separator;
- contents += in_str;
- return *this;
-}
-path path::operator+(path const& in) const {
- path new_path = contents;
- new_path += in;
- return new_path;
-}
-path path::operator+(std::string const& in) const {
- path new_path = contents;
- new_path += in;
- return new_path;
-}
-path path::operator+(const char* in) const {
- path new_path(contents);
- new_path += in;
- return new_path;
-}
-
-path path::operator/(path const& in) const {
- path new_path = contents;
- new_path /= in;
- return new_path;
-}
-path path::operator/(std::string const& in) const {
- path new_path = contents;
- new_path /= in;
- return new_path;
-}
-path path::operator/(const char* in) const {
- path new_path(contents);
- new_path /= in;
- return new_path;
-}
-
-path path::parent_path() const {
- auto last_div = contents.rfind(path_separator);
- if (last_div == std::string::npos) return "";
- return path(contents.substr(0, last_div));
-}
-bool path::has_parent_path() const {
- auto last_div = contents.rfind(path_separator);
- return last_div != std::string::npos;
-}
-path path::filename() const {
- auto last_div = contents.rfind(path_separator);
- return path(contents.substr(last_div + 1, contents.size() - last_div + 1));
-}
-
-path path::extension() const {
- auto last_div = contents.rfind(path_separator);
- auto ext_div = contents.rfind('.');
- // Make sure to not get the special `.` and `..`, as well as any filename that being with a dot, like .profile
- if (last_div + 1 == ext_div || (last_div + 2 == ext_div && contents[last_div + 1] == '.')) return path("");
- path temp = path(contents.substr(ext_div, contents.size() - ext_div + 1));
-
- return path(contents.substr(ext_div, contents.size() - ext_div + 1));
-}
-
-path path::stem() const {
- auto last_div = contents.rfind(path_separator);
- auto ext_div = contents.rfind('.');
- if (last_div + 1 == ext_div || (last_div + 2 == ext_div && contents[last_div + 1] == '.')) {
- return path(contents.substr(last_div + 1, contents.size() - last_div + 1));
- }
- return path(contents.substr(last_div + 1, ext_div - last_div - 1));
-}
-
-path& path::replace_filename(path const& replacement) {
- *this = parent_path() / replacement.str();
- return *this;
-}
-
+namespace fs {
// internal implementation helper for per-platform creating & destroying folders
-int create_folder(path const& path) {
+int create_folder(std::filesystem::path const& path) {
#if defined(WIN32)
- return _wmkdir(widen(path.str()).c_str());
+ return _wmkdir(path.c_str());
#else
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
return 0;
#endif
}
-int delete_folder_contents(path const& folder) {
+int delete_folder_contents(std::filesystem::path const& folder) {
#if defined(WIN32)
- std::wstring folder_utf16 = widen(folder.str());
- if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW(folder_utf16.c_str()) && GetLastError() == ERROR_FILE_NOT_FOUND) {
+ if (INVALID_FILE_ATTRIBUTES == GetFileAttributesW(folder.c_str()) && GetLastError() == ERROR_FILE_NOT_FOUND) {
// nothing to delete
return 0;
}
- std::wstring search_path = folder_utf16 + L"/*.*";
- std::string s_p = folder.str() + "/";
+ std::filesystem::path search_path = folder / "*.*";
WIN32_FIND_DATAW fd;
HANDLE hFind = ::FindFirstFileW(search_path.c_str(), &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- std::string file_name_utf8 = narrow(fd.cFileName);
+ std::filesystem::path file_name = fd.cFileName;
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- if (!string_eq(file_name_utf8.c_str(), ".") && !string_eq(file_name_utf8.c_str(), "..")) {
- delete_folder(s_p + file_name_utf8);
+ if (file_name != "." && file_name != "..") {
+ delete_folder(fd.cFileName);
}
} else {
- std::string child_name = s_p + file_name_utf8;
- DeleteFileW(widen(child_name).c_str());
+ DeleteFileW((folder / fd.cFileName).native().c_str());
}
} while (::FindNextFileW(hFind, &fd));
::FindClose(hFind);
@@ -388,7 +276,7 @@
/* Skip the names "." and ".." as we don't want to recurse on them. */
if (string_eq(file->d_name, ".") || string_eq(file->d_name, "..")) continue;
- path file_path = folder / file->d_name;
+ std::filesystem::path file_path = folder / file->d_name;
struct stat statbuf;
if (!stat(file_path.c_str(), &statbuf)) {
if (S_ISDIR(statbuf.st_mode))
@@ -404,29 +292,23 @@
#endif
}
-int delete_folder(path const& folder) {
+int delete_folder(std::filesystem::path const& folder) {
int ret = delete_folder_contents(folder);
if (ret != 0) return ret;
#if defined(WIN32)
- _wrmdir(widen(folder.str()).c_str());
+ _wrmdir(folder.native().c_str());
return 0;
#else
return rmdir(folder.c_str());
#endif
}
-#if defined(WIN32)
-std::wstring native_path(const std::string& utf8) { return widen(utf8); }
-#else
-const std::string& native_path(const std::string& utf8) { return utf8; }
-#endif
-
-FolderManager::FolderManager(path root_path, std::string name) noexcept : folder(root_path / name) {
+FolderManager::FolderManager(std::filesystem::path root_path, std::string name) noexcept : folder(root_path / name) {
delete_folder_contents(folder);
create_folder(folder);
}
FolderManager::~FolderManager() noexcept {
- if (folder.str().empty()) return;
+ if (folder.empty()) return;
auto list_of_files_to_delete = files;
// remove(file) modifies the files variable, copy the list before deleting it
// Note: the allocation tests currently leak the loaded driver handles because in an OOM scenario the loader doesn't bother
@@ -437,70 +319,72 @@
}
delete_folder(folder);
}
-FolderManager::FolderManager(FolderManager&& other) noexcept : folder(other.folder), files(other.files) {
- other.folder.str().clear();
-}
+FolderManager::FolderManager(FolderManager&& other) noexcept : folder(other.folder), files(other.files) { other.folder.clear(); }
FolderManager& FolderManager::operator=(FolderManager&& other) noexcept {
folder = other.folder;
files = other.files;
- other.folder.str().clear();
+ other.folder.clear();
return *this;
}
-path FolderManager::write_manifest(std::string const& name, std::string const& contents) {
- path out_path = folder / name;
+std::filesystem::path FolderManager::write_manifest(std::filesystem::path const& name, std::string const& contents) {
+ std::filesystem::path out_path = folder / name;
auto found = std::find(files.begin(), files.end(), name);
if (found != files.end()) {
std::cout << "Overwriting manifest " << name << ". Was this intended?\n";
} else {
files.emplace_back(name);
}
- auto file = std::ofstream(native_path(out_path.str()), std::ios_base::trunc | std::ios_base::out);
+ auto file = std::ofstream(out_path, std::ios_base::trunc | std::ios_base::out);
if (!file) {
- std::cerr << "Failed to create manifest " << name << " at " << out_path.str() << "\n";
+ std::cerr << "Failed to create manifest " << name << " at " << out_path << "\n";
return out_path;
}
file << contents << std::endl;
return out_path;
}
-void FolderManager::add_existing_file(std::string const& file_name) { files.emplace_back(file_name); }
+void FolderManager::add_existing_file(std::filesystem::path const& file_name) { files.emplace_back(file_name); }
// close file handle, delete file, remove `name` from managed file list.
-void FolderManager::remove(std::string const& name) {
- path out_path = folder / name;
+void FolderManager::remove(std::filesystem::path const& name) {
+ std::filesystem::path out_path = folder / name;
auto found = std::find(files.begin(), files.end(), name);
if (found != files.end()) {
+#if defined(WIN32)
+ int rc = _wremove(out_path.c_str());
+#else
int rc = std::remove(out_path.c_str());
+#endif
if (rc != 0) {
- std::cerr << "Failed to remove file " << name << " at " << out_path.str() << "\n";
+ std::cerr << "Failed to remove file " << name << " at " << out_path << "\n";
}
files.erase(found);
} else {
- std::cout << "Couldn't remove file " << name << " at " << out_path.str() << ".\n";
+ std::cout << "Couldn't remove file " << name << " at " << out_path << ".\n";
}
}
// copy file into this folder
-path FolderManager::copy_file(path const& file, std::string const& new_name) {
+std::filesystem::path FolderManager::copy_file(std::filesystem::path const& file, std::filesystem::path const& new_name) {
auto new_filepath = folder / new_name;
auto found = std::find(files.begin(), files.end(), new_name);
if (found != files.end()) {
std::cout << "File location already contains" << new_name << ". Is this a bug?\n";
- } else if (file.str() == new_filepath.str()) {
+ } else if (file == new_filepath) {
std::cout << "Trying to copy " << new_name << " into itself. Is this a bug?\n";
} else {
files.emplace_back(new_name);
}
- std::ifstream src(native_path(file.str()), std::ios::binary);
+ std::ifstream src(file, std::ios::binary);
if (!src) {
- std::cerr << "Failed to create file " << file.str() << " for copying from\n";
+ std::cerr << "Failed to create file " << file << " for copying from\n";
return new_filepath;
}
- std::ofstream dst(native_path(new_filepath.str()), std::ios::binary);
+ std::ofstream dst(new_filepath, std::ios::binary);
if (!dst) {
- std::cerr << "Failed to create file " << new_filepath.str() << " for copying to\n";
+ std::cerr << "Failed to create file " << new_filepath << " for copying to\n";
return new_filepath;
}
dst << src.rdbuf();
@@ -660,4 +544,7 @@
}
return utf16;
}
+#else
+std::string narrow(const std::string& utf16) { return utf16; }
+std::string widen(const std::string& utf8) { return utf8; }
#endif
diff --git a/tests/framework/test_util.h b/tests/framework/test_util.h
index a89c0d7..fb45239 100644
--- a/tests/framework/test_util.h
+++ b/tests/framework/test_util.h
@@ -31,7 +31,6 @@
* All the standard library includes and main platform specific includes
* Dll export macro
* Manifest ICD & Layer structs
- * path abstraction class - modelled after C++17's filesystem::path
* FolderManager - manages the contents of a folder, cleaning up when needed
* per-platform library loading - mirrors the vk_loader_platform
* LibraryWrapper - RAII wrapper for a library
@@ -53,6 +52,7 @@
#include <utility>
#include <memory>
#include <functional>
+#include <filesystem>
#include <cassert>
#include <cstring>
@@ -180,75 +180,16 @@
struct ManifestICD; // forward declaration for FolderManager::write
struct ManifestLayer; // forward declaration for FolderManager::write
+std::string escape_backslashes_for_json(std::string const& in_path);
+std::string escape_backslashes_for_json(std::filesystem::path const& in_path);
namespace fs {
-std::string make_native(std::string const&);
-struct path {
-#if defined(WIN32)
- static const char path_separator = '\\';
-#elif COMMON_UNIX_PLATFORMS
- static const char path_separator = '/';
-#endif
-
- public:
- path() {}
- path(std::string const& in) : contents(make_native(in)) {}
- path(const char* in) : contents(make_native(std::string(in))) {}
-
- // concat paths without directoryseperator
- path& operator+=(path const& in);
- path& operator+=(std::string const& in);
- path& operator+=(const char* in);
-
- // append paths with directoryseperator
- path& operator/=(path const& in);
- path& operator/=(std::string const& in);
- path& operator/=(const char* in);
-
- // concat paths without directory seperator
- path operator+(path const& in) const;
- path operator+(std::string const& in) const;
- path operator+(const char* in) const;
-
- // append paths with directory seperator
- path operator/(path const& in) const;
- path operator/(std::string const& in) const;
- path operator/(const char* in) const;
-
- // accessors
- path parent_path() const; // Everything before the last path separator, if there is one.
- bool has_parent_path() const; // True if the path contains more than just a filename.
- path filename() const; // Everything after the last path separator.
- path extension() const; // The file extension, if it has one.
- path stem() const; // The filename minus the extension.
-
- // modifiers
- path& replace_filename(path const& replacement);
-
- // get c style string
- const char* c_str() const { return contents.c_str(); }
- // get C++ style string
- std::string const& str() const { return contents; }
- std::string& str() { return contents; }
- size_t size() const { return contents.size(); }
-
- // equality
- bool operator==(path const& other) const noexcept { return contents == other.contents; }
- bool operator!=(path const& other) const noexcept { return !(*this == other); }
-
- private:
- std::string contents;
-};
-
-std::string fixup_backslashes_in_path(std::string const& in_path);
-fs::path fixup_backslashes_in_path(fs::path const& in_path);
-
-int create_folder(path const& path);
-int delete_folder(path const& folder);
+int create_folder(std::filesystem::path const& path);
+int delete_folder(std::filesystem::path const& folder);
class FolderManager {
public:
- explicit FolderManager(path root_path, std::string name) noexcept;
+ explicit FolderManager(std::filesystem::path root_path, std::string name) noexcept;
~FolderManager() noexcept;
FolderManager(FolderManager const&) = delete;
FolderManager& operator=(FolderManager const&) = delete;
@@ -256,25 +197,25 @@
FolderManager& operator=(FolderManager&& other) noexcept;
// Add a manifest to the folder
- path write_manifest(std::string const& name, std::string const& contents);
+ std::filesystem::path write_manifest(std::filesystem::path const& name, std::string const& contents);
// Add an already existing file to the manager, so it will be cleaned up automatically
- void add_existing_file(std::string const& file_name);
+ void add_existing_file(std::filesystem::path const& file_name);
// close file handle, delete file, remove `name` from managed file list.
- void remove(std::string const& name);
+ void remove(std::filesystem::path const& name);
// copy file into this folder with name `new_name`. Returns the full path of the file that was copied
- path copy_file(path const& file, std::string const& new_name);
+ std::filesystem::path copy_file(std::filesystem::path const& file, std::filesystem::path const& new_name);
// location of the managed folder
- path location() const { return folder; }
+ std::filesystem::path location() const { return folder; }
- std::vector<std::string> get_files() const { return files; }
+ std::vector<std::filesystem::path> get_files() const { return files; }
private:
- path folder;
- std::vector<std::string> files;
+ std::filesystem::path folder;
+ std::vector<std::filesystem::path> files;
};
} // namespace fs
@@ -289,25 +230,26 @@
std::string narrow(const std::wstring& utf16);
// Convert an UTF-8 string to an UTF-16 wstring
std::wstring widen(const std::string& utf8);
+#else
+// Do nothing passthrough for the sake of Windows & UTF-16
+std::string narrow(const std::string& utf16);
+// Do nothing passthrough for the sake of Windows & UTF-16
+std::string widen(const std::string& utf8);
#endif
#if defined(WIN32)
typedef HMODULE loader_platform_dl_handle;
-inline loader_platform_dl_handle loader_platform_open_library(const char* lib_path) {
- std::wstring lib_path_utf16 = widen(lib_path);
+inline loader_platform_dl_handle loader_platform_open_library(const wchar_t* lib_path) {
// Try loading the library the original way first.
- loader_platform_dl_handle lib_handle = LoadLibraryW(lib_path_utf16.c_str());
+ loader_platform_dl_handle lib_handle = LoadLibraryW(lib_path);
if (lib_handle == nullptr && GetLastError() == ERROR_MOD_NOT_FOUND) {
// If that failed, then try loading it with broader search folders.
- lib_handle =
- LoadLibraryExW(lib_path_utf16.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
+ lib_handle = LoadLibraryExW(lib_path, nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
}
return lib_handle;
}
-inline char* loader_platform_open_library_error(const char* libPath) {
- static char errorMsg[164];
- snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\" with error %lu", libPath, GetLastError());
- return errorMsg;
+inline void loader_platform_open_library_print_error(std::filesystem::path const& libPath) {
+ std::wcerr << L"Unable to open library: " << libPath << L" due to: " << std::to_wstring(GetLastError()) << L"\n";
}
inline void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); }
inline void* loader_platform_get_proc_address(loader_platform_dl_handle library, const char* name) {
@@ -327,7 +269,9 @@
inline loader_platform_dl_handle loader_platform_open_library(const char* libPath) {
return dlopen(libPath, RTLD_LAZY | RTLD_LOCAL);
}
-inline const char* loader_platform_open_library_error([[maybe_unused]] const char* libPath) { return dlerror(); }
+inline void loader_platform_open_library_print_error(std::filesystem::path const& libPath) {
+ std::wcerr << "Unable to open library: " << libPath << " due to: " << dlerror() << "\n";
+}
inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); }
inline void* loader_platform_get_proc_address(loader_platform_dl_handle library, const char* name) {
assert(library);
@@ -353,11 +297,10 @@
struct LibraryWrapper {
explicit LibraryWrapper() noexcept {}
- explicit LibraryWrapper(fs::path const& lib_path) noexcept : lib_path(lib_path) {
- lib_handle = loader_platform_open_library(lib_path.c_str());
+ explicit LibraryWrapper(std::filesystem::path const& lib_path) noexcept : lib_path(lib_path) {
+ lib_handle = loader_platform_open_library(lib_path.native().c_str());
if (lib_handle == nullptr) {
- fprintf(stderr, "Unable to open library %s: %s\n", lib_path.c_str(),
- loader_platform_open_library_error(lib_path.c_str()));
+ loader_platform_open_library_print_error(lib_path);
assert(lib_handle != nullptr && "Must be able to open library");
}
}
@@ -396,7 +339,7 @@
explicit operator bool() const noexcept { return lib_handle != nullptr; }
loader_platform_dl_handle lib_handle = nullptr;
- fs::path lib_path;
+ std::filesystem::path lib_path;
};
template <typename T>
@@ -597,7 +540,7 @@
struct ManifestICD {
BUILDER_VALUE(ManifestICD, ManifestVersion, file_format_version, {})
BUILDER_VALUE(ManifestICD, uint32_t, api_version, 0)
- BUILDER_VALUE(ManifestICD, fs::path, lib_path, {})
+ BUILDER_VALUE(ManifestICD, std::filesystem::path, lib_path, {})
BUILDER_VALUE(ManifestICD, bool, is_portability_driver, false)
BUILDER_VALUE(ManifestICD, std::string, library_arch, "")
std::string get_manifest_str() const;
@@ -632,7 +575,7 @@
};
BUILDER_VALUE(LayerDescription, std::string, name, {})
BUILDER_VALUE(LayerDescription, Type, type, Type::INSTANCE)
- BUILDER_VALUE(LayerDescription, fs::path, lib_path, {})
+ BUILDER_VALUE(LayerDescription, std::filesystem::path, lib_path, {})
BUILDER_VALUE(LayerDescription, uint32_t, api_version, VK_API_VERSION_1_0)
BUILDER_VALUE(LayerDescription, uint32_t, implementation_version, 0)
BUILDER_VALUE(LayerDescription, std::string, description, {})
@@ -643,7 +586,7 @@
BUILDER_VALUE(LayerDescription, std::string, disable_environment, {})
BUILDER_VECTOR(LayerDescription, std::string, component_layers, component_layer)
BUILDER_VECTOR(LayerDescription, std::string, blacklisted_layers, blacklisted_layer)
- BUILDER_VECTOR(LayerDescription, std::string, override_paths, override_path)
+ BUILDER_VECTOR(LayerDescription, std::filesystem::path, override_paths, override_path)
BUILDER_VECTOR(LayerDescription, FunctionOverride, pre_instance_functions, pre_instance_function)
BUILDER_VECTOR(LayerDescription, std::string, app_keys, app_key)
BUILDER_VALUE(LayerDescription, std::string, library_arch, "")
@@ -1035,12 +978,4 @@
return buffer;
}
-inline std::wstring conver_str_to_wstr(std::string const& input) {
- std::wstring output{};
- output.resize(input.size());
- size_t characters_converted = 0;
- mbstowcs_s(&characters_converted, &output[0], output.size() + 1, input.c_str(), input.size());
- return output;
-}
-
#endif
diff --git a/tests/loader_alloc_callback_tests.cpp b/tests/loader_alloc_callback_tests.cpp
index d618d9d..74c7474 100644
--- a/tests/loader_alloc_callback_tests.cpp
+++ b/tests/loader_alloc_callback_tests.cpp
@@ -434,7 +434,8 @@
for (size_t i = 0; i < invalid_jsons.size(); i++) {
auto file_name = std::string("invalid_implicit_layer_") + std::to_string(i) + ".json";
- fs::path new_path = env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]);
+ std::filesystem::path new_path =
+ env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]);
env.platform_shim->add_manifest(ManifestCategory::implicit_layer, new_path);
}
@@ -525,7 +526,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("auto")
- .set_path(env.get_shimmed_layer_manifest_path(0).str()))));
+ .set_path(env.get_shimmed_layer_manifest_path(0)))));
size_t fail_index = 0;
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -561,7 +562,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("auto")
- .set_path(env.get_shimmed_layer_manifest_path(0).str()))));
+ .set_path(env.get_shimmed_layer_manifest_path(0)))));
size_t fail_index = 0;
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -608,7 +609,8 @@
"test_layer.json");
env.get_test_layer().set_do_spurious_allocations_in_create_instance(true).set_do_spurious_allocations_in_create_device(true);
- env.env_var_vk_icd_filenames.add_to_list((fs::path("totally_made_up") / "path_to_fake" / "jason_file.json").str());
+ env.env_var_vk_icd_filenames.add_to_list("totally_made_up/path_to_fake/jason_file.json");
+ env.env_var_vk_icd_filenames.add_to_list("another\\bonkers\\file_path.json");
size_t fail_index = 0;
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) {
@@ -745,8 +747,8 @@
std::stringstream custom_json_file_contents;
custom_json_file_contents << custom_json_file.rdbuf();
- fs::path new_path = env.get_folder(ManifestLocation::explicit_layer)
- .write_manifest("VK_LAYER_complex_file.json", custom_json_file_contents.str());
+ std::filesystem::path new_path = env.get_folder(ManifestLocation::explicit_layer)
+ .write_manifest("VK_LAYER_complex_file.json", custom_json_file_contents.str());
env.platform_shim->add_manifest(ManifestCategory::explicit_layer, new_path);
size_t fail_index = 0;
diff --git a/tests/loader_envvar_tests.cpp b/tests/loader_envvar_tests.cpp
index 73b48ec..30824f5 100644
--- a/tests/loader_envvar_tests.cpp
+++ b/tests/loader_envvar_tests.cpp
@@ -78,9 +78,9 @@
// export vk_icdNegotiateLoaderICDInterfaceVersion and vk_icdGetInstanceProcAddr
TEST(EnvVarICDOverrideSetup, version_2_negotiate_interface_version_and_icd_gipa_unicode) {
FrameworkEnvironment env{};
- env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_UNICODE)
+ env.add_icd(TestICDDetails(widen(TEST_ICD_PATH_VERSION_2_UNICODE))
.set_discovery_type(ManifestDiscoveryType::env_var)
- .set_json_name(TEST_JSON_NAME_VERSION_2_UNICODE));
+ .set_json_name(widen(TEST_JSON_NAME_VERSION_2_UNICODE)));
InstWrapper inst{env.vulkan_functions};
inst.CheckCreate();
@@ -203,8 +203,8 @@
// Set up a layer path that includes default and user-specified locations,
// so that the test app can find them. Include some badly specified elements as well.
// Need to redirect the 'home' directory
- fs::path HOME = "/home/fake_home";
- EnvVarWrapper home_env_var{"HOME", HOME.str()};
+ std::filesystem::path HOME = "/home/fake_home";
+ EnvVarWrapper home_env_var{"HOME", HOME};
EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", ":/tmp/goober:::::/tmp/goober/::::"};
EnvVarWrapper xdg_config_home_env_var{"XDG_CONFIG_HOME", ":/tmp/goober:::::/tmp/goober2/::::"};
EnvVarWrapper xdg_data_dirs_env_var{"XDG_DATA_DIRS", "::::/tmp/goober3:/tmp/goober4/with spaces:::"};
@@ -218,10 +218,10 @@
inst.CheckCreate();
auto check_paths = [](DebugUtilsLogger const& debug_log, ManifestCategory category) {
- EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober/vulkan") / category_path_name(category)).str()));
- EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober2/vulkan") / category_path_name(category)).str()));
- EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober3/vulkan") / category_path_name(category)).str()));
- EXPECT_TRUE(debug_log.find((fs::path("/tmp/goober4/with spaces/vulkan") / category_path_name(category)).str()));
+ EXPECT_TRUE(debug_log.find((std::filesystem::path("/tmp/goober/vulkan") / category_path_name(category))));
+ EXPECT_TRUE(debug_log.find((std::filesystem::path("/tmp/goober2/vulkan") / category_path_name(category))));
+ EXPECT_TRUE(debug_log.find((std::filesystem::path("/tmp/goober3/vulkan") / category_path_name(category))));
+ EXPECT_TRUE(debug_log.find((std::filesystem::path("/tmp/goober4/with spaces/vulkan") / category_path_name(category))));
};
check_paths(env.debug_log, ManifestCategory::icd);
check_paths(env.debug_log, ManifestCategory::implicit_layer);
@@ -307,10 +307,10 @@
// Now set up a layer path that includes default and user-specified locations,
// so that the test app can find them. Include some badly specified elements as well.
// Need to redirect the 'home' directory
- fs::path HOME = "/home/fake_home";
- EnvVarWrapper home_env_var{"HOME", HOME.str()};
+ std::filesystem::path HOME = "/home/fake_home";
+ EnvVarWrapper home_env_var{"HOME", HOME};
std::string vk_layer_path = ":/tmp/carol::::/:";
- vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str();
+ vk_layer_path += (HOME / "/ with spaces/:::::/tandy:");
EnvVarWrapper layer_path_env_var{"VK_LAYER_PATH", vk_layer_path};
InstWrapper inst1{env.vulkan_functions};
inst1.create_info.add_layer(layer_name);
@@ -320,7 +320,7 @@
// look for VK_LAYER_PATHS
EXPECT_TRUE(env.debug_log.find("/tmp/carol"));
EXPECT_TRUE(env.debug_log.find("/tandy"));
- EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/").str()));
+ EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/")));
env.debug_log.clear();
@@ -352,10 +352,10 @@
// Set up a layer path that includes default and user-specified locations,
// so that the test app can find them. Include some badly specified elements as well.
// Need to redirect the 'home' directory
- fs::path HOME = "/home/fake_home";
- EnvVarWrapper home_env_var{"HOME", HOME.str()};
+ std::filesystem::path HOME = "/home/fake_home";
+ EnvVarWrapper home_env_var{"HOME", HOME};
std::string vk_layer_path = ":/tmp/carol::::/:";
- vk_layer_path += (HOME / "/ with spaces/:::::/tandy:").str();
+ vk_layer_path += (HOME / "/ with spaces/:::::/tandy:");
EnvVarWrapper add_layer_path_env_var{"VK_ADD_LAYER_PATH", vk_layer_path};
InstWrapper inst1{env.vulkan_functions};
@@ -366,7 +366,7 @@
// look for VK_ADD_LAYER_PATHS
EXPECT_TRUE(env.debug_log.find("/tmp/carol"));
EXPECT_TRUE(env.debug_log.find("/tandy"));
- EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/").str()));
+ EXPECT_TRUE(env.debug_log.find((HOME / "/ with spaces/")));
env.debug_log.clear();
diff --git a/tests/loader_layer_tests.cpp b/tests/loader_layer_tests.cpp
index 762865e..e06d88e 100644
--- a/tests/loader_layer_tests.cpp
+++ b/tests/loader_layer_tests.cpp
@@ -988,7 +988,7 @@
#if defined(WIN32)
env.platform_shim->add_manifest(ManifestCategory::implicit_layer, env.get_folder(ManifestLocation::override_layer).location());
#elif COMMON_UNIX_PLATFORMS
- env.platform_shim->redirect_path(fs::path(USER_LOCAL_SHARE_DIR "/vulkan/implicit_layer.d"),
+ env.platform_shim->redirect_path(std::filesystem::path(USER_LOCAL_SHARE_DIR "/vulkan/implicit_layer.d"),
env.get_folder(ManifestLocation::override_layer).location());
#endif
@@ -1512,14 +1512,14 @@
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)))
.get_manifest_str());
- env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(regular_layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
- "meta_test_layer.json");
+ env.add_implicit_layer(
+ ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(regular_layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(override_layer_folder.location())),
+ "meta_test_layer.json");
InstWrapper inst{env.vulkan_functions};
inst.create_info.set_api_version(1, 1, 0);
@@ -1551,14 +1551,14 @@
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)))
.get_manifest_str());
- env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(special_layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
- "meta_test_layer.json");
+ env.add_implicit_layer(
+ ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(special_layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(override_layer_folder.location())),
+ "meta_test_layer.json");
InstWrapper inst{env.vulkan_functions};
inst.create_info.set_api_version(1, 1, 0);
@@ -1598,7 +1598,7 @@
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
.add_component_layer(regular_layer_name)
.set_disable_environment("DisableMeIfYouCan")
- .add_override_path(env.get_folder(ManifestLocation::override_layer).location().str())),
+ .add_override_path(env.get_folder(ManifestLocation::override_layer).location())),
"meta_test_layer.json");
auto meta_layer_path = env.get_folder(ManifestLocation::override_layer).location();
@@ -1613,7 +1613,7 @@
std::string("Ignoring VK_LAYER_PATH. The Override layer is active and has override paths set, which takes priority. "
"VK_LAYER_PATH is set to ") +
env.env_var_vk_layer_paths.value()));
- ASSERT_TRUE(env.debug_log.find("Override layer has override paths set to " + meta_layer_path.str()));
+ ASSERT_TRUE(env.debug_log.find("Override layer has override paths set to " + meta_layer_path.string()));
env.layers.clear();
}
@@ -1646,7 +1646,7 @@
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
.add_component_layers({regular_layer_name, implicit_layer_name})
.set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
+ .add_override_path(override_layer_folder.location())),
"meta_test_layer.json");
InstWrapper inst{env.vulkan_functions};
@@ -1672,14 +1672,14 @@
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)))
.get_manifest_str());
- env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 0, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(regular_layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
- "meta_test_layer.json");
+ env.add_implicit_layer(
+ ManifestLayer{}.set_file_format_version({1, 0, 0}).add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(regular_layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(override_layer_folder.location())),
+ "meta_test_layer.json");
InstWrapper inst{env.vulkan_functions};
inst.create_info.set_api_version(1, 1, 0);
@@ -1767,15 +1767,15 @@
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)))
.get_manifest_str());
- auto override_folder_location = fs::make_native(override_layer_folder.location().str());
- env.add_implicit_layer(TestLayerDetails{ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(regular_layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
- "meta_test_layer.json"});
+ auto override_folder_location = override_layer_folder.location().string();
+ env.add_implicit_layer(TestLayerDetails{
+ ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(regular_layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(override_layer_folder.location())),
+ "meta_test_layer.json"});
{ // try with no elevated privileges
auto layer_props = env.GetLayerProperties(2);
@@ -1822,14 +1822,14 @@
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0)))
.get_manifest_str());
- env.add_implicit_layer(TestLayerDetails{ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(regular_layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(override_layer_folder.location().str()))),
- "meta_test_layer.json"}
+ env.add_implicit_layer(TestLayerDetails{
+ ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(regular_layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(override_layer_folder.location())),
+ "meta_test_layer.json"}
.set_discovery_type(ManifestDiscoveryType::unsecured_generic));
{ // try with no elevated privileges
@@ -1939,7 +1939,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(false)));
env.update_loader_settings(env.loader_settings);
@@ -2279,7 +2279,7 @@
auto& layer1 = env.get_test_layer(0);
layer1.set_description("actually_layer_1");
layer1.set_make_spurious_log_in_create_instance("actually_layer_1");
- env.env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().str());
+ env.env_var_vk_layer_paths.add_to_list(narrow(env.get_folder(ManifestLocation::override_layer).location()));
env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(same_layer_name_1)
@@ -2354,7 +2354,7 @@
auto& layer1 = env.get_test_layer(0);
layer1.set_description("actually_layer_1");
layer1.set_make_spurious_log_in_create_instance("actually_layer_1");
- env.add_env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().str());
+ env.add_env_var_vk_layer_paths.add_to_list(narrow(env.get_folder(ManifestLocation::override_layer).location()));
env.add_explicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
.set_name(same_layer_name_1)
@@ -2503,7 +2503,7 @@
.set_is_dir(true));
auto& layer2 = env.get_test_layer(1);
layer2.set_description("actually_layer_2");
- env.env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().str());
+ env.env_var_vk_layer_paths.add_to_list(env.get_folder(ManifestLocation::override_layer).location().string());
auto layer_props = env.GetLayerProperties(2);
ASSERT_TRUE(string_eq(layer_name, layer_props[0].layerName));
@@ -5124,7 +5124,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(false)));
env.update_loader_settings(env.loader_settings);
@@ -5206,7 +5206,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
@@ -5278,7 +5278,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
@@ -5358,7 +5358,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
@@ -5431,7 +5431,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
@@ -5476,15 +5476,14 @@
"test_layer_all.json"}
.set_discovery_type(ManifestDiscoveryType::override_folder));
- env.add_implicit_layer(
- ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
- ManifestLayer::LayerDescription{}
- .set_name(lunarg_meta_layer_name)
- .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
- .add_component_layer(layer_name)
- .set_disable_environment("DisableMeIfYouCan")
- .add_override_path(fs::make_native(env.get_folder(ManifestLocation::override_layer).location().str()))),
- "meta_test_layer.json");
+ env.add_implicit_layer(ManifestLayer{}.set_file_format_version({1, 2, 0}).add_layer(
+ ManifestLayer::LayerDescription{}
+ .set_name(lunarg_meta_layer_name)
+ .set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0))
+ .add_component_layer(layer_name)
+ .set_disable_environment("DisableMeIfYouCan")
+ .add_override_path(env.get_folder(ManifestLocation::override_layer).location().string())),
+ "meta_test_layer.json");
EnvVarWrapper allow{"VK_LOADER_LAYERS_ALLOW", layer_name};
@@ -5531,7 +5530,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
diff --git a/tests/loader_regression_tests.cpp b/tests/loader_regression_tests.cpp
index 41b0925..523b5bf 100644
--- a/tests/loader_regression_tests.cpp
+++ b/tests/loader_regression_tests.cpp
@@ -3844,7 +3844,7 @@
auto null_path = env.get_folder(ManifestLocation::null).location() / "test_layer.json";
- env.platform_shim->add_manifest(ManifestCategory::explicit_layer, null_path.str());
+ env.platform_shim->add_manifest(ManifestCategory::explicit_layer, null_path);
const char* layer_name = "TestLayer";
env.add_explicit_layer(
@@ -3862,7 +3862,7 @@
TEST(DuplicateRegistryEntries, Drivers) {
FrameworkEnvironment env{};
auto null_path = env.get_folder(ManifestLocation::null).location() / "test_icd_0.json";
- env.platform_shim->add_manifest(ManifestCategory::icd, null_path.str());
+ env.platform_shim->add_manifest(ManifestCategory::icd, null_path);
env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA}.set_discovery_type(ManifestDiscoveryType::null_dir))
.add_physical_device("physical_device_0")
@@ -3872,7 +3872,7 @@
InstWrapper inst{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
inst.CheckCreate();
- ASSERT_TRUE(env.debug_log.find(std::string("Skipping adding of json file \"") + null_path.str() +
+ ASSERT_TRUE(env.debug_log.find(std::string("Skipping adding of json file \"") + null_path.string() +
"\" from registry \"HKEY_LOCAL_MACHINE\\" VK_DRIVERS_INFO_REGISTRY_LOC
"\" to the list due to duplication"));
}
@@ -3880,8 +3880,8 @@
TEST(LibraryLoading, SystemLocations) {
FrameworkEnvironment env{};
- EnvVarWrapper ld_library_path("LD_LIBRARY_PATH", env.get_folder(ManifestLocation::driver).location().str());
- ld_library_path.add_to_list(env.get_folder(ManifestLocation::explicit_layer).location().str());
+ EnvVarWrapper ld_library_path("LD_LIBRARY_PATH", env.get_folder(ManifestLocation::driver).location().string());
+ ld_library_path.add_to_list(narrow(env.get_folder(ManifestLocation::explicit_layer).location()));
auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2).set_library_path_type(LibraryPathType::default_search_paths))
.add_physical_device({});
@@ -3920,11 +3920,11 @@
.add_physical_device({});
auto driver_path = env.get_icd_manifest_path(0);
std::string symlink_name = "symlink_to_driver.json";
- fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
+ std::filesystem::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name);
int res = symlink(driver_path.c_str(), symlink_path.c_str());
ASSERT_EQ(res, 0);
- EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", symlink_path.str()};
+ EnvVarWrapper xdg_config_dirs_env_var{"XDG_CONFIG_DIRS", symlink_path};
InstWrapper inst{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
@@ -3939,7 +3939,7 @@
auto driver_path = env.get_icd_manifest_path(0);
std::string symlink_name = "symlink_to_driver.json";
- fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
+ std::filesystem::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name);
int res = symlink(driver_path.c_str(), symlink_path.c_str());
ASSERT_EQ(res, 0);
@@ -3955,13 +3955,13 @@
TEST(ManifestDiscovery, InvalidSymlinkXDGEnvVar) {
FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)};
std::string symlink_name = "symlink_to_nothing.json";
- fs::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
- fs::path invalid_driver_path = env.get_folder(ManifestLocation::driver).location() / "nothing_here.json";
+ std::filesystem::path symlink_path = env.get_folder(ManifestLocation::driver_env_var).location() / symlink_name;
+ std::filesystem::path invalid_driver_path = env.get_folder(ManifestLocation::driver).location() / "nothing_here.json";
int res = symlink(invalid_driver_path.c_str(), symlink_path.c_str());
ASSERT_EQ(res, 0);
env.get_folder(ManifestLocation::driver_env_var).add_existing_file(symlink_name);
- EnvVarWrapper xdg_config_dirs_env_var{symlink_path.str()};
+ EnvVarWrapper xdg_config_dirs_env_var{symlink_path};
InstWrapper inst{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
@@ -3972,8 +3972,8 @@
TEST(ManifestDiscovery, InvalidSymlink) {
FrameworkEnvironment env{FrameworkSettings{}.set_enable_default_search_paths(false)};
std::string symlink_name = "symlink_to_nothing.json";
- fs::path symlink_path = env.get_folder(ManifestLocation::driver).location() / symlink_name;
- fs::path invalid_driver_path = env.get_folder(ManifestLocation::driver_env_var).location() / "nothing_here.json";
+ std::filesystem::path symlink_path = env.get_folder(ManifestLocation::driver).location() / symlink_name;
+ std::filesystem::path invalid_driver_path = env.get_folder(ManifestLocation::driver_env_var).location() / "nothing_here.json";
int res = symlink(invalid_driver_path.c_str(), symlink_path.c_str());
ASSERT_EQ(res, 0);
env.get_folder(ManifestLocation::driver).add_existing_file(symlink_name);
@@ -4201,7 +4201,7 @@
for (size_t i = 0; i < invalid_jsons.size(); i++) {
auto file_name = std::string("invalid_driver_") + std::to_string(i) + ".json";
- fs::path new_path = env.get_folder(ManifestLocation::driver).write_manifest(file_name, invalid_jsons[i]);
+ std::filesystem::path new_path = env.get_folder(ManifestLocation::driver).write_manifest(file_name, invalid_jsons[i]);
env.platform_shim->add_manifest(ManifestCategory::icd, new_path);
}
@@ -4225,7 +4225,8 @@
for (size_t i = 0; i < invalid_jsons.size(); i++) {
auto file_name = std::string("invalid_implicit_layer_") + std::to_string(i) + ".json";
- fs::path new_path = env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]);
+ std::filesystem::path new_path =
+ env.get_folder(ManifestLocation::implicit_layer).write_manifest(file_name, invalid_jsons[i]);
env.platform_shim->add_manifest(ManifestCategory::implicit_layer, new_path);
}
@@ -4233,13 +4234,13 @@
inst.CheckCreate();
}
#if defined(WIN32)
-void add_dxgi_adapter(FrameworkEnvironment& env, const char* name, LUID luid, uint32_t vendor_id) {
+void add_dxgi_adapter(FrameworkEnvironment& env, std::filesystem::path const& name, LUID luid, uint32_t vendor_id) {
auto& driver = env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6).set_discovery_type(ManifestDiscoveryType::null_dir));
driver.set_min_icd_interface_version(5);
driver.set_max_icd_interface_version(6);
driver.setup_WSI();
driver.set_icd_api_version(VK_API_VERSION_1_1);
- driver.physical_devices.emplace_back(name);
+ driver.physical_devices.emplace_back(name.string());
auto& pd0 = driver.physical_devices.back();
pd0.properties.apiVersion = VK_API_VERSION_1_1;
driver.set_adapterLUID(luid);
@@ -4258,8 +4259,7 @@
DXGI_ADAPTER_DESC1 desc{};
desc.VendorId = known_driver_list.at(vendor_id).vendor_id;
desc.AdapterLuid = luid;
- auto wide_name = conver_str_to_wstr(name);
- wcsncpy_s(desc.Description, 128, wide_name.c_str(), wide_name.size());
+ wcsncpy_s(desc.Description, 128, name.c_str(), name.native().size());
env.platform_shim->add_dxgi_adapter(GpuType::discrete, desc);
env.platform_shim->add_d3dkmt_adapter(
diff --git a/tests/loader_settings_tests.cpp b/tests/loader_settings_tests.cpp
index 03c0143..4bb60cd 100644
--- a/tests/loader_settings_tests.cpp
+++ b/tests/loader_settings_tests.cpp
@@ -31,7 +31,7 @@
[[maybe_unused]] bool use_secure = false) {
std::string s = "Using layer configurations found in loader settings from ";
#if defined(WIN32)
- return s + env.get_folder(ManifestLocation::settings_location).location().str() + "\\vk_loader_settings.json";
+ return s + (env.get_folder(ManifestLocation::settings_location).location() / "vk_loader_settings.json").string();
#elif COMMON_UNIX_PLATFORMS
if (use_secure)
return s + "/etc/vulkan/loader_settings.d/vk_loader_settings.json";
@@ -54,7 +54,7 @@
AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(regular_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path().str())
+ .set_path(env.get_shimmed_layer_manifest_path())
.set_control("on"))));
{
auto layer_props = env.GetLayerProperties(1);
@@ -81,11 +81,10 @@
"regular_test_layer.json"}
.set_discovery_type(ManifestDiscoveryType::override_folder));
env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting(
- AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
- LoaderSettingsLayerConfiguration{}
- .set_name(regular_layer_name)
- .set_path(env.get_layer_manifest_path().str())
- .set_control("on"))));
+ AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(regular_layer_name)
+ .set_path(env.get_layer_manifest_path())
+ .set_control("on"))));
{
auto layer_props = env.GetLayerProperties(1);
EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name));
@@ -123,11 +122,10 @@
"regular_test_layer.json"}
.set_discovery_type(ManifestDiscoveryType::override_folder));
env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting(
- AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
- LoaderSettingsLayerConfiguration{}
- .set_name(regular_layer_name)
- .set_path(env.get_layer_manifest_path().str())
- .set_control("on"))));
+ AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(regular_layer_name)
+ .set_path(env.get_layer_manifest_path())
+ .set_control("on"))));
{
auto layer_props = env.GetLayerProperties(1);
EXPECT_TRUE(string_eq(layer_props.at(0).layerName, regular_layer_name));
@@ -179,7 +177,7 @@
.add_stderr_log_filter("all")
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(app_specific_layer_name)
- .set_path(env.get_layer_manifest_path(0).str())
+ .set_path(env.get_layer_manifest_path(0))
.set_control("on"))
.add_app_key("key0"))
// configuration that should never be used
@@ -198,7 +196,7 @@
.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(global_layer_name)
- .set_path(env.get_layer_manifest_path(1).str())
+ .set_path(env.get_layer_manifest_path(1))
.set_control("on"))));
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2)).add_physical_device({});
{
@@ -215,7 +213,7 @@
}
env.debug_log.clear();
// Set one set to contain the current executable path
- env.loader_settings.app_specific_settings.at(0).add_app_key(fs::fixup_backslashes_in_path(test_platform_executable_path()));
+ env.loader_settings.app_specific_settings.at(0).add_app_key(escape_backslashes_for_json(test_platform_executable_path()));
env.update_loader_settings(env.loader_settings);
{
auto layer_props = env.GetLayerProperties(1);
@@ -245,10 +243,7 @@
env.update_loader_settings(
env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
- LoaderSettingsLayerConfiguration{}
- .set_name(layer_name)
- .set_path(env.get_layer_manifest_path(0).str())
- .set_control("auto"))));
+ LoaderSettingsLayerConfiguration{}.set_name(layer_name).set_path(env.get_layer_manifest_path(0)).set_control("auto"))));
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
{
EnvVarWrapper instance_layers{"VK_INSTANCE_LAYERS", layer_name};
@@ -292,7 +287,7 @@
AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(implicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("off")
.set_treat_as_implicit_manifest(true))));
{
@@ -337,19 +332,19 @@
ASSERT_TRUE(string_eq(layers.at(1).layerName, implicit_layer_name2));
}
// Now setup the settings file to contain a specific order
- env.update_loader_settings(LoaderSettings{}.add_app_specific_setting(
- AppSpecificSettings{}
- .add_stderr_log_filter("all")
- .add_layer_configuration(LoaderSettingsLayerConfiguration{}
- .set_name(implicit_layer_name1)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
- .set_control("auto")
- .set_treat_as_implicit_manifest(true))
- .add_layer_configuration(LoaderSettingsLayerConfiguration{}
- .set_name(implicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(1).str())
- .set_control("auto")
- .set_treat_as_implicit_manifest(true))));
+ env.update_loader_settings(
+ LoaderSettings{}.add_app_specific_setting(AppSpecificSettings{}
+ .add_stderr_log_filter("all")
+ .add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(implicit_layer_name1)
+ .set_path(env.get_shimmed_layer_manifest_path(0))
+ .set_control("auto")
+ .set_treat_as_implicit_manifest(true))
+ .add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(implicit_layer_name2)
+ .set_path(env.get_shimmed_layer_manifest_path(1))
+ .set_control("auto")
+ .set_treat_as_implicit_manifest(true))));
{
auto layer_props = env.GetLayerProperties(2);
ASSERT_TRUE(string_eq(layer_props.at(0).layerName, implicit_layer_name1));
@@ -365,19 +360,19 @@
}
// Flip the order and store the settings in the env for later use in the test
- env.loader_settings = LoaderSettings{}.add_app_specific_setting(
- AppSpecificSettings{}
- .add_stderr_log_filter("all")
- .add_layer_configuration(LoaderSettingsLayerConfiguration{}
- .set_name(implicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(1).str())
- .set_control("auto")
- .set_treat_as_implicit_manifest(true))
- .add_layer_configuration(LoaderSettingsLayerConfiguration{}
- .set_name(implicit_layer_name1)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
- .set_control("auto")
- .set_treat_as_implicit_manifest(true)));
+ env.loader_settings =
+ LoaderSettings{}.add_app_specific_setting(AppSpecificSettings{}
+ .add_stderr_log_filter("all")
+ .add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(implicit_layer_name2)
+ .set_path(env.get_shimmed_layer_manifest_path(1))
+ .set_control("auto")
+ .set_treat_as_implicit_manifest(true))
+ .add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(implicit_layer_name1)
+ .set_path(env.get_shimmed_layer_manifest_path(0))
+ .set_control("auto")
+ .set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
{
@@ -404,7 +399,7 @@
env.loader_settings.app_specific_settings.at(0).layer_configurations.begin() + 1,
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name3)
- .set_path(env.get_shimmed_layer_manifest_path(2).str())
+ .set_path(env.get_shimmed_layer_manifest_path(2))
.set_control("on"));
env.update_loader_settings(env.loader_settings);
{
@@ -438,7 +433,7 @@
AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("off"))));
{
ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0));
@@ -592,12 +587,12 @@
.add_stderr_log_filter("all")
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(2).str())
+ .set_path(env.get_shimmed_layer_manifest_path(2))
.set_control("on"))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location"))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(implicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(3).str())
+ .set_path(env.get_shimmed_layer_manifest_path(3))
.set_control("on")
.set_treat_as_implicit_manifest(true))));
@@ -641,11 +636,11 @@
.add_stderr_log_filter("all")
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on"))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(1).str())
+ .set_path(env.get_shimmed_layer_manifest_path(1))
.set_control("on"))));
auto layer_props = env.GetLayerProperties(2);
ASSERT_TRUE(string_eq(layer_props.at(0).layerName, explicit_layer_name));
@@ -679,11 +674,11 @@
.add_stderr_log_filter("all")
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on"))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on"))));
auto layer_props = env.GetLayerProperties(1);
@@ -721,7 +716,7 @@
AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(settings_explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on"))));
ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0));
@@ -787,13 +782,13 @@
.add_stderr_log_filter("all")
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(settings_explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on")
.set_treat_as_implicit_manifest(false))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location"))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(settings_implicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(1).str())
+ .set_path(env.get_shimmed_layer_manifest_path(1))
.set_control("auto")
.set_treat_as_implicit_manifest(true))));
{
@@ -876,22 +871,22 @@
std::vector<LoaderSettingsLayerConfiguration> layer_configs{4};
layer_configs.at(0)
.set_name(explicit_layer_name1)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_control("on")
.set_treat_as_implicit_manifest(false);
layer_configs.at(1)
.set_name(explicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(1).str())
+ .set_path(env.get_shimmed_layer_manifest_path(1))
.set_control("on")
.set_treat_as_implicit_manifest(false);
layer_configs.at(2)
.set_name(implicit_layer_name1)
- .set_path(env.get_shimmed_layer_manifest_path(2).str())
+ .set_path(env.get_shimmed_layer_manifest_path(2))
.set_control("on")
.set_treat_as_implicit_manifest(true);
layer_configs.at(3)
.set_name(implicit_layer_name2)
- .set_path(env.get_shimmed_layer_manifest_path(3).str())
+ .set_path(env.get_shimmed_layer_manifest_path(3))
.set_control("on")
.set_treat_as_implicit_manifest(true);
@@ -972,7 +967,7 @@
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(non_env_var_layer_name2)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(2).str()))
+ .set_path(env.get_shimmed_layer_manifest_path(2)))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}.set_control("unordered_layer_location"))));
{
auto layer_props = env.GetLayerProperties(3);
@@ -1053,15 +1048,15 @@
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name1)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(1).str()))
+ .set_path(env.get_shimmed_layer_manifest_path(1)))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(non_env_var_layer_name2)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(2).str()))
+ .set_path(env.get_shimmed_layer_manifest_path(2)))
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(implicit_layer_name1)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true))));
{
auto layer_props = env.GetLayerProperties(3);
@@ -1118,7 +1113,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
.set_control("off")
- .set_path(env.get_shimmed_layer_manifest_path(0).str()))));
+ .set_path(env.get_shimmed_layer_manifest_path(0)))));
{
ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0));
@@ -1155,7 +1150,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
.set_control("off")
- .set_path(env.get_shimmed_layer_manifest_path(0).str()))));
+ .set_path(env.get_shimmed_layer_manifest_path(0)))));
EnvVarWrapper vk_instance_layers{"VK_LOADER_LAYERS_ENABLE", explicit_layer_name};
ASSERT_NO_FATAL_FAILURE(env.GetLayerProperties(0));
@@ -1182,7 +1177,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str()))));
+ .set_path(env.get_shimmed_layer_manifest_path(0)))));
EnvVarWrapper vk_instance_layers{"VK_LOADER_LAYERS_DISABLE", explicit_layer_name};
auto layer_props = env.GetLayerProperties(1);
@@ -1209,11 +1204,10 @@
"regular_test_layer.json"}
.set_discovery_type(ManifestDiscoveryType::override_folder));
env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting(
- AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
- LoaderSettingsLayerConfiguration{}
- .set_name(regular_layer_name)
- .set_path(env.get_layer_manifest_path().str())
- .set_control("on"))));
+ AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(regular_layer_name)
+ .set_path(env.get_layer_manifest_path())
+ .set_control("on"))));
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
auto layer_props = env.GetLayerProperties(1);
@@ -1242,11 +1236,10 @@
"regular_test_layer.json"}
.set_discovery_type(ManifestDiscoveryType::override_folder));
env.update_loader_settings(env.loader_settings.set_file_format_version({1, 0, 0}).add_app_specific_setting(
- AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
- LoaderSettingsLayerConfiguration{}
- .set_name(regular_layer_name)
- .set_path(env.get_layer_manifest_path().str())
- .set_control("on"))));
+ AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(LoaderSettingsLayerConfiguration{}
+ .set_name(regular_layer_name)
+ .set_path(env.get_layer_manifest_path())
+ .set_control("on"))));
env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
// Make sure it works if the settings file is in the HKEY_LOCAL_MACHINE
@@ -1296,7 +1289,7 @@
LoaderSettingsLayerConfiguration{}
.set_name(implicit_layer_name)
.set_control("on")
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
env.update_loader_settings(env.loader_settings);
{
@@ -1419,7 +1412,7 @@
env.loader_settings.add_app_specific_setting(AppSpecificSettings{}.add_stderr_log_filter("all").add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(implicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path(0).str())
+ .set_path(env.get_shimmed_layer_manifest_path(0))
.set_treat_as_implicit_manifest(true)));
// control is set to on
@@ -1528,7 +1521,7 @@
AppSpecificSettings{}
.add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(explicit_layer_name)
- .set_path(env.get_shimmed_layer_manifest_path().str())
+ .set_path(env.get_shimmed_layer_manifest_path())
.set_control("on"))
.add_layer_configuration(
LoaderSettingsLayerConfiguration{}.set_name("VK_LAYER_missing").set_path("/road/to/nowhere").set_control("on"))));
@@ -1537,7 +1530,7 @@
expected_output_verbose += "Layer Configurations count = 2\n";
expected_output_verbose += "---- Layer Configuration [0] ----\n";
expected_output_verbose += std::string("Name: ") + explicit_layer_name + "\n";
- expected_output_verbose += "Path: " + env.get_shimmed_layer_manifest_path().str() + "\n";
+ expected_output_verbose += "Path: " + env.get_shimmed_layer_manifest_path().string() + "\n";
expected_output_verbose += "Control: on\n";
expected_output_verbose += "---- Layer Configuration [1] ----\n";
expected_output_verbose += "Name: VK_LAYER_missing\n";
@@ -1648,7 +1641,7 @@
.set_discovery_type(ManifestDiscoveryType::override_folder));
env.loader_settings.app_specific_settings.at(0).add_layer_configuration(LoaderSettingsLayerConfiguration{}
.set_name(layer_name + std::to_string(i))
- .set_path(env.get_layer_manifest_path(i).str())
+ .set_path(env.get_layer_manifest_path(i))
.set_control("on"));
}
env.update_loader_settings(env.loader_settings);
@@ -1678,7 +1671,7 @@
env.loader_settings.app_specific_settings.at(0).add_layer_configuration(
LoaderSettingsLayerConfiguration{}
.set_name(layer_name + std::to_string(layer_count - i - 1))
- .set_path(env.get_layer_manifest_path(layer_count - i - 1).str())
+ .set_path(env.get_layer_manifest_path(layer_count - i - 1))
.set_control("on"));
}
env.update_loader_settings(env.loader_settings);
diff --git a/tests/loader_testing_main.cpp b/tests/loader_testing_main.cpp
index 75e145d..f6e3d71 100644
--- a/tests/loader_testing_main.cpp
+++ b/tests/loader_testing_main.cpp
@@ -56,16 +56,16 @@
#endif
// clean up folders from old test
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "null_dir");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_env_vars_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_layer_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_env_var_layer_folder");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_add_env_var_layer_folder");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "implicit_layer_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "override_layer_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "app_package_manifests");
- fs::delete_folder(fs::path(FRAMEWORK_BUILD_DIRECTORY) / "macos_bundle");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "null_dir");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "icd_env_vars_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_layer_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_env_var_layer_folder");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "explicit_add_env_var_layer_folder");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "implicit_layer_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "override_layer_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "app_package_manifests");
+ fs::delete_folder(std::filesystem::path(FRAMEWORK_BUILD_DIRECTORY) / "macos_bundle");
// make sure the tests don't find these env-vars if they were set on the system
EnvVarWrapper vk_icd_filenames_env_var{"VK_ICD_FILENAMES"};
diff --git a/tests/loader_version_tests.cpp b/tests/loader_version_tests.cpp
index e800d6a..c13c7f6 100644
--- a/tests/loader_version_tests.cpp
+++ b/tests/loader_version_tests.cpp
@@ -1380,7 +1380,8 @@
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
inst.CheckCreate();
- ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") + env.get_test_icd_path().str() +
+ ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") +
+ env.get_test_icd_path().string() +
"\" contained a 1.1 or greater API version, but "
"vkEnumerateInstanceVersion returned 1.0, treating as a 1.0 ICD"));
}
@@ -1397,7 +1398,8 @@
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
inst.CheckCreate();
- ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") + env.get_test_icd_path().str() +
+ ASSERT_TRUE(env.debug_log.find(std::string("terminator_CreateInstance: Manifest ICD for \"") +
+ env.get_test_icd_path().string() +
"\" contained a 1.1 or greater API version, but does "
"not support vkEnumerateInstanceVersion, treating as a 1.0 ICD"));
}