Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make copying more predictable. #73

Merged
merged 3 commits into from
Mar 9, 2024
Merged

Make copying more predictable. #73

merged 3 commits into from
Mar 9, 2024

Conversation

floitsch
Copy link
Member

@floitsch floitsch commented Mar 8, 2024

Don't make the copy operation dependent on whether the target directory exists or not.
Making it dependent has the following drawbacks:

  1. the directory could be created outside of our control.
  2. It's annoying in programs to test first whether the target exists.
  3. There isn't a good way to copy the content of the source to the target if it already exists.

Don't make the copy operation dependent on whether the target directory
exists or not.
Making it dependent has the following drawbacks:
1. the directory could be created outside of our control.
2. It's annoying in programs to test first whether the target exists.
3. There isn't a good way to copy the content of the source to the
   target if it already exists.
@floitsch floitsch requested a review from kasperl March 8, 2024 23:12
@floitsch
Copy link
Member Author

floitsch commented Mar 8, 2024

Also enabled some tests and fixed them.

@floitsch floitsch requested a review from erikcorry March 8, 2024 23:55
src/file.toit Outdated
if not target-stat:
mkdir target source-permissions
if is-windows and source-permissions & SPECIAL-WINDOWS-PERMISSIONS_ != 0:
// The Windows file attributes are not taking into account when creating a new directory.
Copy link
Member

Choose a reason for hiding this comment

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

taking should be taken

Copy link
Member Author

Choose a reason for hiding this comment

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

done

src/file.toit Outdated
out-writer := Writer out-stream
try:
while data := in-stream.read:
out-writer.write data
finally:
in-stream.close
out-writer.close
if is-windows and (source-permissions & SPECIAL-WINDOWS-PERMISSIONS_) != 0:
// The Windows file attributes are not taking into account when creating a new file.
Copy link
Member

Choose a reason for hiding this comment

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

and here

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@floitsch floitsch merged commit da453fb into main Mar 9, 2024
6 checks passed
@floitsch floitsch deleted the floitsch/copy-target branch March 9, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants