Skip to content

Conversation

@pawelsadlo
Copy link
Contributor

@pawelsadlo pawelsadlo commented Mar 6, 2025

Bug appears when we call os.copy with mergeFolders = true

if target doesn't contain inner directories corresponding to source os.copy with mergeFolders will fail try to copy source directory as it was a file and fail with FileAlreadyExistsException

createFolders = true doesn't fix things

this is because os.isDir(targetDir) returns false if path doesn't exist

This PR adds explicit target directory creation if sourceDirectory is directory and targetDirectory doesn't exist

@pawelsadlo pawelsadlo marked this pull request as ready for review March 6, 2025 12:27
@pawelsadlo pawelsadlo changed the title fix os.copy fix os.copy with mergeFolders=true Mar 6, 2025
@lefou
Copy link
Member

lefou commented Mar 6, 2025

Can you please add a test for the case you described?

@pawelsadlo
Copy link
Contributor Author

@lefou Never mind, I misunderstood replaceExisting parameter behaviour (thought it would simply omit coliding files but its actually throwing exception)

@pawelsadlo pawelsadlo closed this Mar 6, 2025
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