|
|
@@ -43,8 +43,6 @@ File* AndroidMountPoint::open(const char* relative_path, FileOpenMode /*mode*/)
|
|
|
CE_ASSERT(exists(relative_path), "File does not exist: %s", relative_path);
|
|
|
CE_ASSERT(is_file(relative_path), "File is not a regular file: %s", relative_path);
|
|
|
|
|
|
- Log::i("path: %s", relative_path);
|
|
|
-
|
|
|
return CE_NEW(m_allocator, AndroidFile)(relative_path);
|
|
|
}
|
|
|
|
|
|
@@ -63,9 +61,9 @@ const char* AndroidMountPoint::root_path()
|
|
|
//-----------------------------------------------------------------------------
|
|
|
bool AndroidMountPoint::exists(const char* relative_path)
|
|
|
{
|
|
|
- // MountPointEntry info;
|
|
|
+ MountPointEntry info;
|
|
|
|
|
|
- // return get_info(relative_path, info);
|
|
|
+ return get_info(relative_path, info);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -75,51 +73,46 @@ bool AndroidMountPoint::get_info(const char* relative_path, MountPointEntry& inf
|
|
|
{
|
|
|
// Entering OS-DEPENDENT-PATH-MODE (Android assets folder)
|
|
|
|
|
|
- // const char* os_path = relative_path;
|
|
|
-
|
|
|
- // string::strncpy(info.os_path, "", MAX_PATH_LENGTH);
|
|
|
- // string::strncpy(info.relative_path, relative_path, MAX_PATH_LENGTH);
|
|
|
+ const char* os_path = relative_path;
|
|
|
|
|
|
- // AAssetDir* root = AAssetManager_openDir(g_android_asset_manager, "");
|
|
|
+ string::strncpy(info.os_path, "", MAX_PATH_LENGTH);
|
|
|
+ string::strncpy(info.relative_path, relative_path, MAX_PATH_LENGTH);
|
|
|
|
|
|
- // char asset_name[512];
|
|
|
+ AAssetDir* root = AAssetManager_openDir(get_android_asset_manager(), "");
|
|
|
|
|
|
- // string::strncpy(asset_name, AAssetDir_getNextFileName(root), 512);
|
|
|
- // Log::i("AssetManager: %s", asset_name);
|
|
|
+ char asset_name[512];
|
|
|
|
|
|
- return true;
|
|
|
+ string::strncpy(asset_name, AAssetDir_getNextFileName(root), 512);
|
|
|
|
|
|
- // while (asset_name != NULL)
|
|
|
- // {
|
|
|
- // Log::i("AssetManager: %s", asset_name);
|
|
|
- // if (string::strcmp(asset_name, relative_path) == 0)
|
|
|
- // {
|
|
|
- // info.type = MountPointEntry::FILE;
|
|
|
- // AAssetDir_rewind(root);
|
|
|
- // return true;
|
|
|
- // }
|
|
|
-
|
|
|
- // string::strncpy(asset_name, AAssetDir_getNextFileName(root), 512);
|
|
|
- // }
|
|
|
+ while (asset_name != NULL)
|
|
|
+ {
|
|
|
+ Log::i("AssetManager: %s", asset_name);
|
|
|
+ if (string::strcmp(asset_name, relative_path) == 0)
|
|
|
+ {
|
|
|
+ info.type = MountPointEntry::FILE;
|
|
|
+ AAssetDir_rewind(root);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ string::strncpy(asset_name, AAssetDir_getNextFileName(root), 512);
|
|
|
+ }
|
|
|
|
|
|
- // info.type = MountPointEntry::UNKNOWN;
|
|
|
+ info.type = MountPointEntry::UNKNOWN;
|
|
|
|
|
|
- // return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
bool AndroidMountPoint::is_file(const char* relative_path)
|
|
|
{
|
|
|
- // MountPointEntry info;
|
|
|
-
|
|
|
- // if (get_info(relative_path, info))
|
|
|
- // {
|
|
|
- // return info.type == MountPointEntry::FILE;
|
|
|
- // }
|
|
|
+ MountPointEntry info;
|
|
|
|
|
|
- // return false;
|
|
|
+ if (get_info(relative_path, info))
|
|
|
+ {
|
|
|
+ return info.type == MountPointEntry::FILE;
|
|
|
+ }
|
|
|
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
@@ -135,5 +128,12 @@ bool AndroidMountPoint::is_dir(const char* relative_path)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
+const char* AndroidMountPoint::os_path(const char* /*relative_path*/)
|
|
|
+{
|
|
|
+ return "";
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
} // namespace crown
|