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

Set permissions when copying file with progress #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ where
}
let mut file_from = File::open(from)?;
let mut buf = vec![0; options.buffer_size];
let file_size = file_from.metadata()?.len();
let metadata = file_from.metadata()?;
let file_size = metadata.len();
let mut copied_bytes: u64 = 0;

let mut file_to = File::create(to)?;
Expand All @@ -197,6 +198,7 @@ where
Err(e) => return Err(::std::convert::From::from(e)),
}
}
file_to.set_permissions(metadata.permissions())?;
Ok(file_size)
}

Expand Down