Skip to content

make RenameFile() on Windows also replace the file#2060

Merged
psychonic merged 2 commits intoalliedmodders:masterfrom
rtldg:windows-renamefile-replace
May 5, 2024
Merged

make RenameFile() on Windows also replace the file#2060
psychonic merged 2 commits intoalliedmodders:masterfrom
rtldg:windows-renamefile-replace

Conversation

@rtldg
Copy link
Contributor

@rtldg rtldg commented Oct 9, 2023

RenameFile on linux uses rename() which will replace the destination file if it exists. MoveFileA doesn't replace so this is swapping it with MoveFileExA+MOVEFILE_REPLACE_EXISTING which will replace the destination.

@rtldg
Copy link
Contributor Author

rtldg commented Oct 9, 2023

accidentally made the pr on this repo instead my fork when trying to test github actions building the binary for testing. if the binary works correctly though then I'll keep the pr open

edit: it sucks that actions don't cache generated artifacts. that would be very useful if they did. wink wink nudge nudge

BoomShotKapow added a commit to BoomShotKapow/shavit-myreplay that referenced this pull request Oct 9, 2023
Copy link
Member

@psychonic psychonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the available flags, I think we should probably add MOVEFILE_COPY_ALLOWED as well

@rtldg
Copy link
Contributor Author

rtldg commented May 5, 2024

Looking at the available flags, I think we should probably add MOVEFILE_COPY_ALLOWED as well

Good idea. Added it.

Copy link
Member

@psychonic psychonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@psychonic psychonic merged commit 908ffdb into alliedmodders:master May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants