Add "setJsBundlesDirectory" method to CatalystInstanceImpl

Differential Revision: D6042493

fbshipit-source-id: 950c6d6bdc2e0b62b14c9bcfc86233159a002c67
This commit is contained in:
Alex Dvornikov
2017-11-01 06:33:37 -07:00
committed by Facebook Github Bot
parent 21917ab7bf
commit b5651d945c
8 changed files with 42 additions and 24 deletions

View File

@@ -25,20 +25,5 @@ JSModulesUnbundle *RAMBundleRegistry::getBundle(uint32_t bundleId) const {
return m_bundles.at(bundleId).get();
}
std::string RAMBundleRegistry::jsBundlesDir(std::string entryFile) {
char *pEntryFile = const_cast<char *>(entryFile.c_str());
std::string dir = dirname(pEntryFile);
std::string entryName = basename(pEntryFile);
std::size_t dotPosition = entryName.find(".");
if (dotPosition != std::string::npos) {
entryName.erase(dotPosition, std::string::npos);
}
std::string path = "js-bundles/" + entryName + "/";
// android's asset manager does not work with paths that start with a dot
return dir == "." ? path : dir + "/" + path;
}
} // namespace react
} // namespace facebook