/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCxxPlatform/react/io/platform/cxx/ResourceLoader.cpp
37 строк
1007 B
Andrew Datsenko
Add react_cxx_platform_react_io cmake (#52169)
23 июн 2025, 09:48
23 июн 2025, 09:48
5961edd
Код
Авторство
О чём код?
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include <react/io/ResourceLoader.h> #include <cassert> #include <fstream> #include <sstream> namespace facebook::react { bool ResourceLoader::isResourceDirectory(const std::string& path) { return std::filesystem::is_directory(path); } bool ResourceLoader::isResourceFile(const std::string& path) { return std::filesystem::exists(path) && !std::filesystem::is_directory(path); } std::string ResourceLoader::getResourceFileContents(const std::string& path) { std::ifstream file(path, std::ios::binary); if (!file.good()) { throw std::runtime_error("File not found " + path); } std::stringstream buffer; buffer << file.rdbuf(); return buffer.str(); } std::filesystem::path ResourceLoader::getCacheRootPath() { return std::filesystem::temp_directory_path(); } } // namespace facebook::react