react-native/ReactCommon/cxxreact/JSIndexedRAMBundleRegistry.cpp
Alex Dvornikov 9e01d72103 Unify supplimentary bundle path creation logic between Android and iOS
Differential Revision: D5941546

fbshipit-source-id: c9b8fab887f480faa373c26a1d5ba310e8acde78
2017-10-04 15:16:27 -07:00

23 lines
770 B
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#include "JSIndexedRAMBundleRegistry.h"
#include <cxxreact/JSIndexedRAMBundle.h>
#include <folly/Memory.h>
#include "oss-compat-util.h"
namespace facebook {
namespace react {
JSIndexedRAMBundleRegistry::JSIndexedRAMBundleRegistry(std::unique_ptr<JSModulesUnbundle> mainBundle, const std::string& entryFile):
RAMBundleRegistry(std::move(mainBundle)), m_baseDirectoryPath(jsBundlesDir(entryFile)) {}
std::unique_ptr<JSModulesUnbundle> JSIndexedRAMBundleRegistry::bundleById(uint32_t index) const {
std::string bundlePathById = m_baseDirectoryPath + toString(index) + ".jsbundle";
return folly::make_unique<JSIndexedRAMBundle>(bundlePathById.c_str());
}
} // namespace react
} // namespace facebook