Minor optimization for assets extraction

This commit is contained in:
Deve 2018-10-25 22:16:56 +02:00
parent 7902431abe
commit 571d3d3ba0
4 changed files with 18 additions and 13 deletions

View File

@ -607,7 +607,7 @@ fi
# Generate directories list
echo "Generate directories list"
find assets/* -type d > assets/directories.txt
find assets/* -type d | sort > assets/directories.txt
sed -i s/'.\/assets\/'// assets/directories.txt
sed -i s/'assets\/'// assets/directories.txt

View File

@ -368,7 +368,14 @@ bool AssetsAndroid::extractDir(std::string dir_name)
return true;
}
if (!m_file_manager->checkAndCreateDirectoryP(output_dir))
bool dir_created = m_file_manager->checkAndCreateDirectory(output_dir);
if (!dir_created)
{
dir_created = m_file_manager->checkAndCreateDirectoryP(output_dir);
}
if (!dir_created)
{
Log::warn("AssetsAndroid", "Couldn't create %s directory",
output_dir.c_str());
@ -653,4 +660,4 @@ std::string AssetsAndroid::getLibPath()
#endif
return "";
}
}

View File

@ -816,16 +816,14 @@ bool FileManager::checkAndCreateDirectoryP(const std::string &path)
for (unsigned int i=0; i<split.size(); i++)
{
current_path += split[i] + "/";
Log::verbose("[FileManager]", "Checking for: '%s",
current_path.c_str());
if (!m_file_system->existFile(io::path(current_path.c_str())))
//Log::verbose("[FileManager]", "Checking for: '%s",
// current_path.c_str());
if (!checkAndCreateDirectory(current_path))
{
if (!checkAndCreateDirectory(current_path))
{
Log::error("[FileManager]", "Can't create dir '%s'",
current_path.c_str());
break;
}
Log::error("[FileManager]", "Can't create dir '%s'",
current_path.c_str());
break;
}
}
bool error = checkAndCreateDirectory(path);

View File

@ -117,7 +117,6 @@ private:
const;
void makePath(std::string& path, const std::string& dir,
const std::string& fname) const;
bool checkAndCreateDirectory(const std::string &path);
io::path createAbsoluteFilename(const std::string &f);
void checkAndCreateConfigDir();
void checkAndCreateAddonsDir();
@ -148,6 +147,7 @@ public:
std::string getReplayDir() const;
std::string getCachedTexturesDir() const;
std::string getGPDir() const;
bool checkAndCreateDirectory(const std::string &path);
bool checkAndCreateDirectoryP(const std::string &path);
const std::string &getAddonsDir() const;
std::string getAddonsFile(const std::string &name);