From f41d2a51169c1ce75c76b751af5860bc34f621a8 Mon Sep 17 00:00:00 2001 From: bernat Date: Wed, 5 Feb 2020 19:20:12 +0100 Subject: [PATCH] Protect again against replacing package --- .../Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp index 921b653bb..cd5e92f2b 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp @@ -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); }