Commandlet -rebuild option is not working properly

I am using the FMOD plugin v2.02.07

According to the documentation the Unreal Engine commandlet FMODGenerateAssets supports a -rebuild option to clean up the FMOD assets before generating them. However the option doesn’t work as described, as it doesn’t delete any file. I traced the problem to line 43 of FMODGenerateAssetsCommandlet.cpp which is building the wrong pathname for the directories to be cleaned up.

Unfortunately I haven’t been able to reproduce your issue. Given that line 43 of FMODGenerateAssetsCommandlet.cpp is generating the wrong path, the value that Settings.ContentBrowserPrefix is set to may be incorrect - you can check and change its value in the Unreal Editor by going to Project Settings → Plugins → FMOD Studio → Advanced. By default it should be set to /Game/FMOD/. Failing that, could you provide me with the path you’re expecting line 43 to generate, and the path that is actually being generated?

I checked and Settings.ContentBrowserPrefix is actually set to /Game/FMOD without the trailing slash. I see that this is a problem, because the string is simply concatenated with the subfolder name. However, even adding the trailing slash, the code produces the wrong path. For example it produces paths like
../../../Projects/PROJECT/Content//Game/FMOD/Banks, while the correct path should be ../../../Projects/PROJECT/Content/FMOD/Banks (the double slash is not a problem, but having Game there is).

Sorry for the late reply,

I’m still not able to replicate your issue unfortunately. Settings.ContentBrowserPrefix being set to /Game/FMOD/ is causing no errors on my end - the produced paths are along the lines of ../../../Projects/PROJECT/Content//Game/FMOD/Banks as they are for you, but the commandlet is working as expected.

Can you run me through how you’re using the commandlet? Additionally, Is there anything unconventional about your project structure?

Sorry to revive this thread after so long. You said that you get a path like ../../../Projects/PROJECT/Content//Game/FMOD/Banks which is exactly what I have. However, I disagree that the commandlet is working as expected. The expected behaviour is that the folder ../../../Projects/PROJECT/Content/FMOD/Banks (without “Game”) is to be deleted recursively, but that doesn’t happen. It’s true that the function FileManager.DeleteDirectoryRecursively returns success, but not because the folder has been deleted, but because it doesn’t exists at all, and that is because the path is wrong.

1 Like

I fixed it by using the following code, borrowed from Engine\Source\Developer\SourceControl\Private\SourceControlHelpers.cpp (lines 1404-)

FString CorrectedPath = (Settings.ContentBrowserPrefix + folder).Replace(TEXT("/Game"), TEXT(""), ESearchCase::CaseSensitive);
FString FolderToDelete= FPaths::ProjectContentDir() / CorrectedPath;
FPaths::RemoveDuplicateSlashes(FolderToDelete);

No problem!

I’ve done some more testing, and you do appear to be correct in that the deletion operation does return success, even when the path is wrong. Thanks for pointing this out - I’ve passed this and your solution along to the development team.