修改iOS上js加载逻辑, 优先加载游戏热更目录
This commit is contained in:
parent
a5d459fe3f
commit
07952df53a
@ -50,6 +50,7 @@ public:
|
|||||||
virtual ~FileUtilsApple();
|
virtual ~FileUtilsApple();
|
||||||
/* override functions */
|
/* override functions */
|
||||||
virtual std::string getWritablePath() const override;
|
virtual std::string getWritablePath() const override;
|
||||||
|
virtual std::string getExtFileDirectory() const override;
|
||||||
virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const override;
|
virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const override;
|
||||||
|
|
||||||
virtual ValueMap getValueMapFromFile(const std::string& filename) override;
|
virtual ValueMap getValueMapFromFile(const std::string& filename) override;
|
||||||
|
@ -243,6 +243,21 @@ std::string FileUtilsApple::getWritablePath() const
|
|||||||
return strRet;
|
return strRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FileUtilsApple::getExtFileDirectory() const
|
||||||
|
{
|
||||||
|
if (_writablePath.length())
|
||||||
|
{
|
||||||
|
return _writablePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save to document folder
|
||||||
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
|
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||||
|
std::string strRet = [documentsDirectory UTF8String];
|
||||||
|
strRet.append("/");
|
||||||
|
return strRet;
|
||||||
|
}
|
||||||
|
|
||||||
bool FileUtilsApple::isFileExistInternal(const std::string& filePath) const
|
bool FileUtilsApple::isFileExistInternal(const std::string& filePath) const
|
||||||
{
|
{
|
||||||
if (filePath.empty())
|
if (filePath.empty())
|
||||||
|
@ -231,16 +231,18 @@ void jsb_init_file_operation_delegate()
|
|||||||
|
|
||||||
se::ScriptEngine::getInstance()->setFileOperationDelegate(delegate);
|
se::ScriptEngine::getInstance()->setFileOperationDelegate(delegate);
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> searchPaths;
|
||||||
|
// iOS: /var/mobile/Containers/Data/Application/guid/Documents
|
||||||
std::string path = FileUtils::getInstance()->getWritablePath();
|
std::string path = FileUtils::getInstance()->getWritablePath();
|
||||||
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||||
std::string extPath = FileUtils::getInstance()->getExtFileDirectory();
|
std::string extPath = FileUtils::getInstance()->getExtFileDirectory();
|
||||||
extPath += "luaframework/";
|
extPath += "luaframework/";
|
||||||
path += "luaframework/";
|
path += "luaframework/";
|
||||||
std::vector<std::string> searchPaths;
|
|
||||||
searchPaths.push_back(extPath);
|
searchPaths.push_back(extPath);
|
||||||
|
#endif // CC_PLATFORM_ANDROID
|
||||||
searchPaths.push_back(path);
|
searchPaths.push_back(path);
|
||||||
searchPaths.push_back("");
|
searchPaths.push_back("");
|
||||||
FileUtils::getInstance()->setSearchPaths(searchPaths);
|
FileUtils::getInstance()->setSearchPaths(searchPaths);
|
||||||
// FileUtils::getInstance()->addSearchResolutionsOrder(path, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jsb_enable_debugger(const std::string& debuggerServerAddr, uint32_t port, bool isWaitForConnect)
|
bool jsb_enable_debugger(const std::string& debuggerServerAddr, uint32_t port, bool isWaitForConnect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user