|
@@ -47,11 +47,32 @@
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
bool isCachePath(const char* path)
|
|
bool isCachePath(const char* path)
|
|
{
|
|
{
|
|
- //TODO: implement isCachePath
|
|
|
|
if (!path || !*path)
|
|
if (!path || !*path)
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (path[0] == '/')
|
|
|
|
+ {
|
|
|
|
+ if (strstr(path, Platform::getUserDataDirectory()) != NULL)
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ const char* tmp = Platform::getUserDataDirectory();
|
|
|
|
+ if (strstr(path, tmp+1) != NULL)
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
@@ -121,7 +142,7 @@ File::~File()
|
|
File::Status File::open(const char *filename, const AccessMode openMode)
|
|
File::Status File::open(const char *filename, const AccessMode openMode)
|
|
{
|
|
{
|
|
//If its a cache path then we need to open it using C methods not AssetManager
|
|
//If its a cache path then we need to open it using C methods not AssetManager
|
|
- if (isCachePath(filename))
|
|
|
|
|
|
+ /* if (isCachePath(filename))
|
|
{
|
|
{
|
|
if (dStrlen(filename) > MAX_MAC_PATH_LONG)
|
|
if (dStrlen(filename) > MAX_MAC_PATH_LONG)
|
|
Con::warnf("File::open: Filename length is pretty long...");
|
|
Con::warnf("File::open: Filename length is pretty long...");
|
|
@@ -178,7 +199,7 @@ File::Status File::open(const char *filename, const AccessMode openMode)
|
|
|
|
|
|
// success!
|
|
// success!
|
|
return currentStatus;
|
|
return currentStatus;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
if (dStrlen(filename) > MAX_MAC_PATH_LONG)
|
|
if (dStrlen(filename) > MAX_MAC_PATH_LONG)
|
|
Con::warnf("File::open: Filename length is pretty long...");
|
|
Con::warnf("File::open: Filename length is pretty long...");
|
|
@@ -773,7 +794,7 @@ bool Platform::isFile(const char *path)
|
|
if (!path || !*path)
|
|
if (!path || !*path)
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- if (isCachePath(path))
|
|
|
|
|
|
+ /*if (isCachePath(path))
|
|
{
|
|
{
|
|
// make sure we can stat the file
|
|
// make sure we can stat the file
|
|
struct stat statData;
|
|
struct stat statData;
|
|
@@ -787,7 +808,7 @@ bool Platform::isFile(const char *path)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+*/
|
|
return android_IsFile(path);
|
|
return android_IsFile(path);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -798,7 +819,7 @@ bool Platform::isDirectory(const char *path)
|
|
if (!path || !*path)
|
|
if (!path || !*path)
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- if (isCachePath(path))
|
|
|
|
|
|
+ /* if (isCachePath(path))
|
|
{
|
|
{
|
|
// make sure we can stat the file
|
|
// make sure we can stat the file
|
|
struct stat statData;
|
|
struct stat statData;
|
|
@@ -811,7 +832,7 @@ bool Platform::isDirectory(const char *path)
|
|
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+*/
|
|
return android_IsDir(path);
|
|
return android_IsDir(path);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -821,7 +842,7 @@ S32 Platform::getFileSize(const char* pFilePath)
|
|
if (!pFilePath || !*pFilePath)
|
|
if (!pFilePath || !*pFilePath)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if (isCachePath(pFilePath))
|
|
|
|
|
|
+ /* if (isCachePath(pFilePath))
|
|
{
|
|
{
|
|
struct stat statData;
|
|
struct stat statData;
|
|
if( stat(pFilePath, &statData) < 0 )
|
|
if( stat(pFilePath, &statData) < 0 )
|
|
@@ -829,7 +850,7 @@ S32 Platform::getFileSize(const char* pFilePath)
|
|
|
|
|
|
// and return it's size in bytes
|
|
// and return it's size in bytes
|
|
return (S32)statData.st_size;
|
|
return (S32)statData.st_size;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
return android_GetFileSize(pFilePath);
|
|
return android_GetFileSize(pFilePath);
|
|
}
|
|
}
|
|
@@ -873,7 +894,7 @@ inline bool isGoodDirectoryCache(dirent* entry)
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
bool Platform::hasSubDirectory(const char *path)
|
|
bool Platform::hasSubDirectory(const char *path)
|
|
{
|
|
{
|
|
- if (isCachePath(path))
|
|
|
|
|
|
+ /*if (isCachePath(path))
|
|
{
|
|
{
|
|
DIR *dir;
|
|
DIR *dir;
|
|
dirent *entry;
|
|
dirent *entry;
|
|
@@ -899,7 +920,7 @@ bool Platform::hasSubDirectory(const char *path)
|
|
return false; // either this dir had no subdirectories, or they were all on the exclude list.
|
|
return false; // either this dir had no subdirectories, or they were all on the exclude list.
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+*/
|
|
android_InitDirList(path);
|
|
android_InitDirList(path);
|
|
char dir[80];
|
|
char dir[80];
|
|
char pdir[255];
|
|
char pdir[255];
|
|
@@ -1065,7 +1086,7 @@ bool recurseDumpDirectoriesCache(const char *basePath, const char *path, Vector<
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
|
|
bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
|
|
{
|
|
{
|
|
- if (isCachePath(path))
|
|
|
|
|
|
+ /*if (isCachePath(path))
|
|
{
|
|
{
|
|
PROFILE_START(dumpDirectories);
|
|
PROFILE_START(dumpDirectories);
|
|
|
|
|
|
@@ -1086,7 +1107,7 @@ bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &direc
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+*/
|
|
PROFILE_START(dumpDirectories);
|
|
PROFILE_START(dumpDirectories);
|
|
|
|
|
|
ResourceManager->initExcludedDirectories();
|
|
ResourceManager->initExcludedDirectories();
|
|
@@ -1201,7 +1222,7 @@ static bool recurseDumpPathCache(const char* curPath, Vector<Platform::FileInfo>
|
|
break;
|
|
break;
|
|
|
|
|
|
// construct the full file path. we need this to get the file size and to recurse
|
|
// construct the full file path. we need this to get the file size and to recurse
|
|
- const U32 len = dStrlen(curPath) + dStrlen(entry->d_name) + 2;
|
|
|
|
|
|
+ const U32 len = dStrlen(curPath) + entry->d_reclen + 2;
|
|
char pathbuf[len];
|
|
char pathbuf[len];
|
|
dSprintf( pathbuf, len, "%s/%s", curPath, entry->d_name);
|
|
dSprintf( pathbuf, len, "%s/%s", curPath, entry->d_name);
|
|
|
|
|
|
@@ -1241,7 +1262,7 @@ static bool recurseDumpPathCache(const char* curPath, Vector<Platform::FileInfo>
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
bool Platform::dumpPath(const char *path, Vector<Platform::FileInfo>& fileVector, S32 depth)
|
|
bool Platform::dumpPath(const char *path, Vector<Platform::FileInfo>& fileVector, S32 depth)
|
|
{
|
|
{
|
|
- if (isCachePath(path))
|
|
|
|
|
|
+ /*if (isCachePath(path))
|
|
{
|
|
{
|
|
PROFILE_START(dumpPath);
|
|
PROFILE_START(dumpPath);
|
|
const S32 len = dStrlen(path) + 1;
|
|
const S32 len = dStrlen(path) + 1;
|
|
@@ -1256,7 +1277,7 @@ bool Platform::dumpPath(const char *path, Vector<Platform::FileInfo>& fileVector
|
|
PROFILE_END();
|
|
PROFILE_END();
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
PROFILE_START(dumpPath);
|
|
PROFILE_START(dumpPath);
|
|
char apath[80];
|
|
char apath[80];
|