Merge pull request #8594 from leoetlino/fs-createfullpath-fix

IOS/FS: Fix CreateFullPath to not create directories that already exist
This commit is contained in:
Léo Lam
2020-02-02 16:50:02 +01:00
committed by GitHub
2 changed files with 24 additions and 3 deletions

View File

@ -115,9 +115,12 @@ ResultCode FileSystem::CreateFullPath(Uid uid, Gid gid, const std::string& path,
if (metadata && metadata->is_file)
return ResultCode::Invalid;
const ResultCode result = CreateDirectory(uid, gid, subpath, attribute, modes);
if (result != ResultCode::Success && result != ResultCode::AlreadyExists)
return result;
if (!metadata)
{
const ResultCode result = CreateDirectory(uid, gid, subpath, attribute, modes);
if (result != ResultCode::Success)
return result;
}
++position;
}