Skip to content

Commit

Permalink
[Error] Do not show warning when the offline cache path does not exist (
Browse files Browse the repository at this point in the history
#5747)

* [Error] Do not show warning when the offline cache path does not exist

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
lin-hitonami and pre-commit-ci[bot] authored Aug 12, 2022
1 parent e7a900a commit 5d91e96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions taichi/runtime/llvm/llvm_offline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ void LlvmOfflineCacheFileWriter::clean_cache(const std::string &path,
{
std::string lock_path = taichi::join_path(path, kMetadataFileLockName);
if (!lock_with_file(lock_path)) {
if (!taichi::path_exists(path)) {
return;
}
TI_WARN("Lock {} failed", lock_path);
return;
}
Expand Down
6 changes: 6 additions & 0 deletions taichi/util/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <sys/stat.h>

#if defined(TI_PLATFORM_WINDOWS)
#include <filesystem>
#endif

TI_NAMESPACE_BEGIN

inline bool path_exists(const std::string &dir) {
struct stat buffer;
return stat(dir.c_str(), &buffer) == 0;
}

// TODO: move to std::filesystem after it's nonexperimental on all platforms
inline void create_directories(const std::string &dir) {
#if defined(TI_PLATFORM_WINDOWS)
Expand Down

0 comments on commit 5d91e96

Please sign in to comment.