MCPcopy Create free account
hub / github.com/NotYetGames/DlgSystem / HandleDialogueRenamed

Method HandleDialogueRenamed

Source/DlgSystem/Private/DlgSystemModule.cpp:279–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void FDlgSystemModule::HandleDialogueRenamed(UDlgDialogue* RenamedDialogue, const FString& OldObjectPath)
280{
281 if (!IsValid(RenamedDialogue))
282 {
283 return;
284 }
285
286 // Rename text file file to new location
287 const FString OldTextFilePathName = UDlgDialogue::GetTextFilePathNameFromAssetPathName(OldObjectPath);
288 if (OldTextFilePathName.IsEmpty())
289 {
290 FDlgLogger::Get().Error(TEXT("OldTextFilePathName is empty. This should never happen"));
291 return;
292 }
293
294 // Current PathName
295 const FString CurrentTextFilePathName = RenamedDialogue->GetTextFilePathName(false);
296 if (OldTextFilePathName == CurrentTextFilePathName)
297 {
298 FDlgLogger::Get().Errorf(
299 TEXT("Dialogue was renamed but the paths before and after are equal :O | `%s` == `%s`"),
300 *OldTextFilePathName, *CurrentTextFilePathName
301 );
302 return;
303 }
304
305 // Iterate over all possible text formats
306 for (const FString& FileExtension : GetDefault<UDlgSystemSettings>()->GetAllTextFileExtensions())
307 {
308 const FString OldFileName = OldTextFilePathName + FileExtension;
309 const FString NewFileName = CurrentTextFilePathName + FileExtension;
310 FDlgHelper::RenameFile(OldFileName, NewFileName, true);
311 }
312}
313
314void FDlgSystemModule::HandleOnPreLoadMap(const FString& MapName)
315{

Callers

nothing calls this directly

Calls 3

GetTextFilePathNameMethod · 0.80
IsValidFunction · 0.50

Tested by

no test coverage detected