diff --git a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp index 252725d1d0..f31a7d6380 100644 --- a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp +++ b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp @@ -782,16 +782,6 @@ namespace AssetProcessor } // if we get here, we are good to go in terms of disk space and sources existing, so we make the best attempt we can. - // first, we broadcast the name of ALL of the outputs we are about to change: - for (const QPair& filePair : outputsToCopy) - { - const QString& productAbsolutePath = filePair.second; - // note that this absolute path is a real file system path, and the following API requires normalized paths: - QString normalized = AssetUtilities::NormalizeFilePath(productAbsolutePath); - AssetProcessor::ProcessingJobInfoBus::Broadcast(&AssetProcessor::ProcessingJobInfoBus::Events::BeginCacheFileUpdate, normalized.toUtf8().constData()); - } - - // after we do the above notify its important that we do not early exit this function without undoing those locks. bool anyFileFailed = false; @@ -815,16 +805,6 @@ namespace AssetProcessor AZ_TracePrintf(AssetBuilderSDK::WarningWindow, "Unable to change permission for the file: %s.\n", productAbsolutePath.toUtf8().data()); } } - - // once we're done, regardless of success or failure, we 'unlock' those files for further process. - // if we failed, also re-trigger them to rebuild (the bool param at the end of the ebus call) - for (const QPair& filePair : outputsToCopy) - { - const QString& productAbsolutePath = filePair.second; - // note that this absolute path is a real file system path, and the following API requires normalized paths: - QString normalized = AssetUtilities::NormalizeFilePath(productAbsolutePath); - AssetProcessor::ProcessingJobInfoBus::Broadcast(&AssetProcessor::ProcessingJobInfoBus::Events::EndCacheFileUpdate, normalized.toUtf8().constData(), anyFileFailed); - } return !anyFileFailed; } diff --git a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp index 3ccef73ded..904e049c71 100644 --- a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp @@ -83,6 +83,10 @@ namespace AssetUtilsInternal timer.start(); do { + QString normalized = AssetUtilities::NormalizeFilePath(outputFile); + AssetProcessor::ProcessingJobInfoBus::Broadcast( + &AssetProcessor::ProcessingJobInfoBus::Events::BeginCacheFileUpdate, normalized.toUtf8().constData()); + //Removing the old file if it exists if (outFile.exists()) { @@ -133,11 +137,19 @@ namespace AssetUtilsInternal } } } while (!timer.hasExpired(waitTimeInSeconds * 1000)); //We will keep retrying until the timer has expired the inputted timeout + + // once we're done, regardless of success or failure, we 'unlock' those files for further process. + // if we failed, also re-trigger them to rebuild (the bool param at the end of the ebus call) + QString normalized = AssetUtilities::NormalizeFilePath(outputFile); + AssetProcessor::ProcessingJobInfoBus::Broadcast( + &AssetProcessor::ProcessingJobInfoBus::Events::EndCacheFileUpdate, normalized.toUtf8().constData(), !operationSucceeded); if (!operationSucceeded) { //operation failed for the given timeout - AZ_Warning(AssetProcessor::ConsoleChannel, false, "WARNING: Could not copy/move source %s to %s, giving up\n", sourceFile.toUtf8().constData(), outputFile.toUtf8().constData()); + AZ_Warning(AssetProcessor::ConsoleChannel, false, "WARNING: Could not %s source from %s to %s, giving up\n", + isCopy ? "copy" : "move (via rename)", + sourceFile.toUtf8().constData(), outputFile.toUtf8().constData()); return false; } else if (failureOccurredOnce)