fixed music resource adding from resource zip to nested folder on Android platorm. Fixed issue 776

This commit is contained in:
rolzad73@gmail.com
2013-06-03 02:15:12 +00:00
parent 1442b73029
commit 7990540096
2 changed files with 73 additions and 37 deletions

View File

@@ -320,6 +320,36 @@ bool JFileSystem::openForWrite(ofstream & File, const string & FilePath, ios_bas
{
string filename = mUserFSPath;
filename.append(FilePath);
#if defined(ANDROID)
DebugTrace("ANDROID");
std::vector<string> dirs;
string path = filename.substr( 0, filename.find_last_of( '/' ) + 1 );
// put it into list
dirs.push_back(path);
//make list of directories that need to be created
do
{
path = path.substr( 0, path.find_last_of( '/', path.size() - 2 ) + 1 );
dirs.push_back(path);
} while (path.compare(mUserFSPath) != 0);
// remove mUserFSPath from list
dirs.pop_back();
// create missing directories
for (std::vector<string>::reverse_iterator it = dirs.rbegin(); it != dirs.rend(); ++it)
{
if(!DirExists(*it))
{
MAKEDIR((*it).c_str());
}
}
#endif
File.open(filename.c_str(), mode);
if (File)