DirectoryScanner.h 1.1 KB

1234567891011121314151617181920212223242526272829
  1. //===- DirectoryScanner.h - Utility functions for DirectoryWatcher --------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "clang/DirectoryWatcher/DirectoryWatcher.h"
  9. #include "llvm/Support/FileSystem.h"
  10. #include <string>
  11. #include <vector>
  12. namespace clang {
  13. /// Gets names (filenames) of items in directory at \p Path.
  14. /// \returns empty vector if \p Path is not a directory, doesn't exist or can't
  15. /// be read from.
  16. std::vector<std::string> scanDirectory(llvm::StringRef Path);
  17. /// Create event with EventKind::Added for every element in \p Scan.
  18. std::vector<DirectoryWatcher::Event>
  19. getAsFileEvents(const std::vector<std::string> &Scan);
  20. /// Gets status of file (or directory) at \p Path.
  21. /// \returns llvm::None if \p Path doesn't exist or can't get the status.
  22. llvm::Optional<llvm::sys::fs::file_status> getFileStatus(llvm::StringRef Path);
  23. } // namespace clang