Protect again against replacing package

This commit is contained in:
bernat 2020-02-05 19:20:12 +01:00 committed by Marc Garcia Puig
parent 5f23dd9e52
commit f41d2a5116
1 changed files with 6 additions and 0 deletions

View File

@ -323,6 +323,12 @@ bool UPrepareAssetsForCookingCommandlet::SavePackage(const FString &PackagePath,
FString PackageFileName = FPackageName::LongPackageNameToFilename(PackagePath,
FPackageName::GetMapPackageExtension());
if (FPaths::FileExists(*PackageFileName))
{
// Will not save package if it already exists
return false;
}
return UPackage::SavePackage(Package, World, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone,
*PackageFileName, GError, nullptr, true, true, SAVE_NoError);
}