Skip to content

Commit

Permalink
fix(filesystem): Update mingw version used for Windows builds and wor…
Browse files Browse the repository at this point in the history
…karound a bug in std::filesystem::copy (endless-sky#10910)

* Update mingw due to issues in std::filesystem relating to unicode characters in paths in previous versions.
* On Windows, Files::Copy will delete the file at the destination, if one exists, before calling std::filesystem::copy as that function does not respect the passed parameter instructing it to overwrite an existing file no Windows at the moment.
  • Loading branch information
tibetiroka authored Jan 18, 2025
1 parent 77d30f2 commit ac3314b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

cd_windows_x64:
name: Windows
runs-on: windows-2022
runs-on: windows-2025
env:
OUTPUT: EndlessSky-win64-continuous.zip
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

release_windows_x64:
name: Windows x64
runs-on: windows-2022
runs-on: windows-2025
env:
OUTPUT: EndlessSky-win64-${{ inputs.release_version }}.zip
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
name: Windows
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: windows-2022
runs-on: windows-2025
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
name: Windows Clang
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: windows-2022
runs-on: windows-2025
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
needs: [changed, build_windows]
name: Data Files
if: ${{ (needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.data == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.ci_config == 'true') && always() }}
runs-on: windows-2022
runs-on: windows-2025
env:
CONTINUOUS: EndlessSky-win64-continuous.zip
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 6 additions & 0 deletions source/Files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ time_t Files::Timestamp(const filesystem::path &filePath)

void Files::Copy(const filesystem::path &from, const filesystem::path &to)
{
#ifdef _WIN32
// Due to a mingw bug, the overwrite_existing flag is not respected on Windows.
// TODO: remove once it is fixed.
if(Exists(to))
Delete(to);
#endif
copy(from, to, filesystem::copy_options::overwrite_existing);
}

Expand Down

0 comments on commit ac3314b

Please sign in to comment.