asar_util.h 960 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_COMMON_ASAR_ASAR_UTIL_H_
  5. #define SHELL_COMMON_ASAR_ASAR_UTIL_H_
  6. #include <memory>
  7. #include <string>
  8. namespace base {
  9. class FilePath;
  10. }
  11. namespace asar {
  12. class Archive;
  13. // Gets or creates a new Archive from the path.
  14. std::shared_ptr<Archive> GetOrCreateAsarArchive(const base::FilePath& path);
  15. // Destroy cached Archive objects.
  16. void ClearArchives();
  17. // Separates the path to Archive out.
  18. bool GetAsarArchivePath(const base::FilePath& full_path,
  19. base::FilePath* asar_path,
  20. base::FilePath* relative_path,
  21. bool allow_root = false);
  22. // Same with base::ReadFileToString but supports asar Archive.
  23. bool ReadFileToString(const base::FilePath& path, std::string* contents);
  24. } // namespace asar
  25. #endif // SHELL_COMMON_ASAR_ASAR_UTIL_H_