mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-23 03:01:20 +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
448 B
C++
24 lines
448 B
C++
/*
|
|
* Copyright (C) 2024 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/helpers/path.h"
|
|
|
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
|
|
|
#include <string>
|
|
|
|
namespace NEO {
|
|
bool pathExists(const std::string &path) {
|
|
struct stat statbuf = {};
|
|
|
|
if (NEO::SysCalls::stat(path.c_str(), &statbuf) == -1) {
|
|
return false;
|
|
}
|
|
|
|
return (statbuf.st_mode & S_IFDIR) != 0;
|
|
}
|
|
} // namespace NEO
|