mirror of https://github.com/axmolengine/axmol.git
issue #1263: Removed CCFileUtils::ccLoadFileIntoMemory in CCFileUtils.mm. Removed some comments.
This commit is contained in:
parent
1b7cc47a34
commit
99dcb4de86
|
@ -217,35 +217,6 @@ void CCFileUtils::setResourcePath(const char *pszResourcePath)
|
|||
assert(0);
|
||||
}
|
||||
|
||||
int CCFileUtils::ccLoadFileIntoMemory(const char *filename, unsigned char **out)
|
||||
{
|
||||
CCAssert( out, "ccLoadFileIntoMemory: invalid 'out' parameter");
|
||||
CCAssert( &*out, "ccLoadFileIntoMemory: invalid 'out' parameter");
|
||||
|
||||
size_t size = 0;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if( !f ) {
|
||||
*out = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
*out = (unsigned char*)malloc(size);
|
||||
size_t read = fread(*out, 1, size, f);
|
||||
if( read != size ) {
|
||||
free(*out);
|
||||
*out = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
std::string& CCFileUtils::removeSuffixFromFile(std::string& cpath )
|
||||
{
|
||||
NSString *ret = nil;
|
||||
|
|
|
@ -250,17 +250,14 @@ void ScriptingCore::runScript(const char *path)
|
|||
#else
|
||||
const char *realPath = CCFileUtils::fullPathFromRelativePath(path);
|
||||
#endif
|
||||
const char *content = NULL;
|
||||
//cjh size_t contentSize = CCFileUtils::ccLoadFileIntoMemory(realPath, &content);
|
||||
content = CCString::stringWithContentsOfFile(realPath)->getCString();
|
||||
if (content/* && contentSize*/) {
|
||||
const char* content = CCString::stringWithContentsOfFile(realPath)->getCString();
|
||||
if (content && strlen(content) > 0) {
|
||||
JSBool ok;
|
||||
jsval rval;
|
||||
ok = JS_EvaluateScript(this->cx, this->global, (char *)content, strlen(content), path, 1, &rval);
|
||||
if (ok == JS_FALSE) {
|
||||
CCLog("error evaluating script:\n%s", content);
|
||||
}
|
||||
//cjh free(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
8a1763799207ad5aec622e3b0d073ef58294a909
|
||||
de658072145651c5caa286fe4d10048e06f04e05
|
|
@ -1 +1 @@
|
|||
8ab5af11b4002da68221bf087d3f014941d4be35
|
||||
f15b1b846b94b2d2b69438899124884963fd9f09
|
Loading…
Reference in New Issue