177dd8a79SJan Korous //===- DirectoryScanner.h - Utility functions for DirectoryWatcher --------===// 277dd8a79SJan Korous // 377dd8a79SJan Korous // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 477dd8a79SJan Korous // See https://llvm.org/LICENSE.txt for license information. 577dd8a79SJan Korous // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 677dd8a79SJan Korous // 777dd8a79SJan Korous //===----------------------------------------------------------------------===// 877dd8a79SJan Korous 977dd8a79SJan Korous #include "clang/DirectoryWatcher/DirectoryWatcher.h" 1077dd8a79SJan Korous #include "llvm/Support/FileSystem.h" 11*9cf4419eSKazu Hirata #include <optional> 1277dd8a79SJan Korous #include <string> 1377dd8a79SJan Korous #include <vector> 1477dd8a79SJan Korous 1577dd8a79SJan Korous namespace clang { 1677dd8a79SJan Korous 1777dd8a79SJan Korous /// Gets names (filenames) of items in directory at \p Path. 1877dd8a79SJan Korous /// \returns empty vector if \p Path is not a directory, doesn't exist or can't 1977dd8a79SJan Korous /// be read from. 2077dd8a79SJan Korous std::vector<std::string> scanDirectory(llvm::StringRef Path); 2177dd8a79SJan Korous 2277dd8a79SJan Korous /// Create event with EventKind::Added for every element in \p Scan. 2377dd8a79SJan Korous std::vector<DirectoryWatcher::Event> 2477dd8a79SJan Korous getAsFileEvents(const std::vector<std::string> &Scan); 2577dd8a79SJan Korous 2677dd8a79SJan Korous /// Gets status of file (or directory) at \p Path. 2735b4fbb5SKazu Hirata /// \returns std::nullopt if \p Path doesn't exist or can't get the status. 28*9cf4419eSKazu Hirata std::optional<llvm::sys::fs::file_status> getFileStatus(llvm::StringRef Path); 2977dd8a79SJan Korous 3077dd8a79SJan Korous } // namespace clang 31