mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: allow writes to copied cas files
This commit is contained in:
parent
bf77b69b0b
commit
e6773144db
2 changed files with 16 additions and 1 deletions
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Correct `pesde.toml` inclusion message in `publish` command by @daimond113
|
- Correct `pesde.toml` inclusion message in `publish` command by @daimond113
|
||||||
|
- Allow writes to files when `link` is false in PackageFS::write_to by @daimond113
|
||||||
|
|
||||||
## [0.5.0-rc.5] - 2024-10-12
|
## [0.5.0-rc.5] - 2024-10-12
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -160,7 +160,21 @@ impl PackageFS {
|
||||||
if link {
|
if link {
|
||||||
std::fs::hard_link(cas_file_path, path)?;
|
std::fs::hard_link(cas_file_path, path)?;
|
||||||
} else {
|
} else {
|
||||||
std::fs::copy(cas_file_path, path)?;
|
let mut f = std::fs::File::create(&path)?;
|
||||||
|
f.write_all(&std::fs::read(cas_file_path)?)?;
|
||||||
|
|
||||||
|
let mut permissions = f.metadata()?.permissions();
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
#[allow(clippy::permissions_set_readonly_false)]
|
||||||
|
permissions.set_readonly(false);
|
||||||
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
permissions.set_mode(permissions.mode() | 0o644);
|
||||||
|
}
|
||||||
|
f.set_permissions(permissions)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FSEntry::Directory => {
|
FSEntry::Directory => {
|
||||||
|
|
Loading…
Reference in a new issue