Skip to content

Commit 0f32825

Browse files
brycehutchingsrpavlik
authored andcommitted
Remove shwapi dependency
1 parent 63d7e3d commit 0f32825

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/common/filesystem_utils.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ bool FileSysUtilsFindFilesInPath(const std::string& path, std::vector<std::strin
152152

153153
#elif defined(XR_OS_WINDOWS)
154154

155-
// For pre C++17 compiler that doesn't support experimental filesystem
156-
#include <shlwapi.h>
155+
bool FileSysUtilsIsRegularFile(const std::string& path) { return !FileSysUtilsIsDirectory(path); }
157156

158-
bool FileSysUtilsIsRegularFile(const std::string& path) { return (1 != PathIsDirectoryW(utf8_to_wide(path).c_str())); }
159-
160-
bool FileSysUtilsIsDirectory(const std::string& path) { return (1 == PathIsDirectoryW(utf8_to_wide(path).c_str())); }
157+
bool FileSysUtilsIsDirectory(const std::string& path) {
158+
const DWORD attr = GetFileAttributesW(utf8_to_wide(path).c_str());
159+
return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY);
160+
}
161161

162-
bool FileSysUtilsPathExists(const std::string& path) { return (1 == PathFileExistsW(utf8_to_wide(path).c_str())); }
162+
bool FileSysUtilsPathExists(const std::string& path) {
163+
return (GetFileAttributesW(utf8_to_wide(path).c_str()) != INVALID_FILE_ATTRIBUTES);
164+
}
163165

164166
bool FileSysUtilsIsAbsolutePath(const std::string& path) {
165167
if ((path[0] == '\\') || (path[1] == ':' && (path[2] == '\\' || path[2] == '/'))) {

src/loader/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ elseif(WIN32)
169169
endforeach()
170170
endif()
171171

172-
target_link_libraries(openxr_loader shlwapi)
173172
target_compile_options(openxr_loader PRIVATE)
174173
generate_export_header(openxr_loader)
175174
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS false)

0 commit comments

Comments
 (0)