DolphinQt: Delete output Sys folder before copying to it

For a long time now, we've had a problem where game INIs persist in
the copied Sys folder if they've been deleted from the original Sys
folder. (I still have hundreds of game INIs locally that only set
EmulationStateId, and we removed those game INIs 6 years ago. On the
buildbot, we do occasionally clear out the build directories manually,
so I'd assume it's not quite as bad there.)

This commit fixes the problem by deleting the output Sys folder before
copying the original Sys folder to the output Sys folder. This should be
a bit slower, but in my testing, the difference seems small. At least if
you have an SSD, which I really hope people have nowadays!

Operating systems other than Windows have not been touched, because:

* Android: Already explicitly deletes the output Sys folder.
* macOS: Does some magic to put the Sys folder in the app bundle, which I
  will simply assume isn't affected by this problem, without testing.
* Linux: Expects the person building to manually manage the Sys folder.
This commit is contained in:
JosJuice 2024-08-15 19:18:16 +02:00
parent 30c58eba96
commit a62f8eac1a
2 changed files with 2 additions and 0 deletions

View File

@ -462,6 +462,7 @@ if(WIN32)
# Copy Sys dir
add_custom_command(TARGET dolphin-emu POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
)

View File

@ -490,6 +490,7 @@
</ItemGroup>
<Target Name="AfterBuild" Inputs="@(AllInputFiles)" Outputs="@(AllInputFiles -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)')">
<Message Text="Copying Data directory..." Importance="High" />
<RemoveDir Directories="$(BinaryOutputDir)Sys" />
<Copy SourceFiles="@(DataSysFiles)" DestinationFolder="$(BinaryOutputDir)%(RecursiveDir)" SkipUnchangedFiles="True" />
<Copy SourceFiles="@(DataTxtFiles)" DestinationFolder="$(BinaryOutputDir)" SkipUnchangedFiles="True" />
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />