Skip to content

Fix libsql-ffi build on Windows #2005

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged
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
20 changes: 9 additions & 11 deletions libsql-ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,20 @@ fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()>
/// propagate into OUT_DIR. If not present, when trying to rewrite a file, a `Permission denied`
/// error will occur.
fn copy_with_cp(from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> {
let status = Command::new("cp")
match Command::new("cp")
.arg("--no-preserve=mode,ownership")
.arg("-R")
.arg(from.as_ref().to_str().unwrap())
.arg(to.as_ref().to_str().unwrap())
.status()?;

if status.success() {
return Ok(());
.status()
{
Ok(status) if status.success() => Ok(()),
_ => match fs::copy(from.as_ref(), to.as_ref()) {
Err(err) if err.kind() == io::ErrorKind::InvalidInput => copy_dir_all(from, to),
Ok(_) => Ok(()),
Err(err) => Err(err),
},
}

return match fs::copy(from.as_ref(), to.as_ref()) {
Err(err) if err.kind() == io::ErrorKind::InvalidInput => copy_dir_all(from, to),
Ok(_) => Ok(()),
Err(err) => Err(err),
};
}

fn make_amalgamation() {
Expand Down
Loading