Loading tools/aapt2/util/Files.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -102,12 +102,25 @@ FileType GetFileType(const std::string& path) { #endif bool mkdirs(const std::string& path) { constexpr const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP; #ifdef _WIN32 // Start after the drive path if present. Calling mkdir with only the drive will cause an error. size_t current_pos = 1u; if (path.size() >= 3 && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) { current_pos = 3u; } #else // Start after the first character so that we don't consume the root '/'. // This is safe to do with unicode because '/' will never match with a continuation character. size_t current_pos = 1u; #endif constexpr const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP; while ((current_pos = path.find(sDirSep, current_pos)) != std::string::npos) { std::string parent_path = path.substr(0, current_pos); if (parent_path.empty()) { continue; } int result = ::android::base::utf8::mkdir(parent_path.c_str(), mode); if (result < 0 && errno != EEXIST) { return false; Loading Loading
tools/aapt2/util/Files.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -102,12 +102,25 @@ FileType GetFileType(const std::string& path) { #endif bool mkdirs(const std::string& path) { constexpr const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP; #ifdef _WIN32 // Start after the drive path if present. Calling mkdir with only the drive will cause an error. size_t current_pos = 1u; if (path.size() >= 3 && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) { current_pos = 3u; } #else // Start after the first character so that we don't consume the root '/'. // This is safe to do with unicode because '/' will never match with a continuation character. size_t current_pos = 1u; #endif constexpr const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP; while ((current_pos = path.find(sDirSep, current_pos)) != std::string::npos) { std::string parent_path = path.substr(0, current_pos); if (parent_path.empty()) { continue; } int result = ::android::base::utf8::mkdir(parent_path.c_str(), mode); if (result < 0 && errno != EEXIST) { return false; Loading