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 # Generate directories list
echo "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
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; 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", Log::warn("AssetsAndroid", "Couldn't create %s directory",
output_dir.c_str()); output_dir.c_str());

View File

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

View File

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