mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
Moved pathExists from SysCalls to path.h. In ULTs, use unchanged pathExists and mock stat, getFileAttributesA instead. Add Windows and Linux ULTs for pathExists. Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
24 lines
471 B
C++
24 lines
471 B
C++
/*
|
|
* Copyright (C) 2024 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/helpers/path.h"
|
|
|
|
#include "shared/source/os_interface/windows/sys_calls.h"
|
|
|
|
#include <string>
|
|
|
|
namespace NEO {
|
|
bool pathExists(const std::string &path) {
|
|
DWORD ret = NEO::SysCalls::getFileAttributesA(path.c_str());
|
|
|
|
if (ret == INVALID_FILE_ATTRIBUTES) {
|
|
return false;
|
|
}
|
|
|
|
return (ret & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
|
}
|
|
} // namespace NEO
|