filesystem_utils.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2017-2025 The Khronos Group Inc.
  2. // Copyright (c) 2017 Valve Corporation
  3. // Copyright (c) 2017 LunarG, Inc.
  4. //
  5. // SPDX-License-Identifier: Apache-2.0 OR MIT
  6. //
  7. // Initial Author: Mark Young <[email protected]>
  8. //
  9. #pragma once
  10. #include <string>
  11. #include <vector>
  12. // Determine if the path indicates a regular file (not a directory or symbolic link)
  13. bool FileSysUtilsIsRegularFile(const std::string& path);
  14. // Determine if the path indicates a directory
  15. bool FileSysUtilsIsDirectory(const std::string& path);
  16. // Determine if the provided path exists on the filesystem
  17. bool FileSysUtilsPathExists(const std::string& path);
  18. // Get the current directory
  19. bool FileSysUtilsGetCurrentPath(std::string& path);
  20. // Get the parent path of a file
  21. bool FileSysUtilsGetParentPath(const std::string& file_path, std::string& parent_path);
  22. // Determine if the provided path is an absolute path
  23. bool FileSysUtilsIsAbsolutePath(const std::string& path);
  24. // Get the absolute path for a provided file
  25. bool FileSysUtilsGetAbsolutePath(const std::string& path, std::string& absolute);
  26. // Get the absolute path for a provided file
  27. bool FileSysUtilsGetCanonicalPath(const std::string& path, std::string& canonical);
  28. // Combine a parent and child directory
  29. bool FileSysUtilsCombinePaths(const std::string& parent, const std::string& child, std::string& combined);
  30. // Parse out individual paths in a path list
  31. bool FileSysUtilsParsePathList(std::string& path_list, std::vector<std::string>& paths);
  32. // Record all the filenames for files found in the provided path.
  33. bool FileSysUtilsFindFilesInPath(const std::string& path, std::vector<std::string>& files);