Fix version file
This commit is contained in:
1 parent
e6bdba1137
commit
f5954446d1
2 files changed
+15
-5
No files matched your search
+5
-1
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix version file
|
||||
|
||||
## [0.2.1] - 2025-10-28
|
||||
|
||||
### Added
|
||||
@@ -56,8 +60,8 @@
|
||||
- First release
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.1...HEAD
|
||||
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.1...HEAD
|
||||
[0.2.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.0...v0.2.1
|
||||
[0.2.0]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.2...v0.2.0
|
||||
[0.1.2]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.1...v0.1.2
|
||||
|
||||
+10
-4
@@ -12,7 +12,7 @@ use flate2::read::GzDecoder;
|
||||
use regex::Regex;
|
||||
use std::{
|
||||
fs::{self},
|
||||
io::{Write, copy},
|
||||
io::copy,
|
||||
path::{Path, PathBuf},
|
||||
sync::mpsc::{self, Receiver, TryRecvError},
|
||||
thread,
|
||||
@@ -158,6 +158,14 @@ fn install<P: AsRef<Path>>(
|
||||
// Skip installation if version file exists
|
||||
let version_file_path = target_dir.as_ref().join("rpob.version");
|
||||
if version_file_path.exists() {
|
||||
let old_version = fs::read_to_string(&version_file_path).unwrap();
|
||||
let current_version = env!("CARGO_PKG_VERSION");
|
||||
|
||||
if old_version != current_version {
|
||||
log::info!("New version detected: {old_version} -> {current_version}");
|
||||
fs::write(&version_file_path, current_version).unwrap();
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -166,9 +174,7 @@ fn install<P: AsRef<Path>>(
|
||||
set_branch_and_platform(&target_dir)?;
|
||||
|
||||
// write version file
|
||||
let mut version_file = fs::File::create(version_file_path)?;
|
||||
let pkg_version = env!("CARGO_PKG_VERSION");
|
||||
version_file.write_all(pkg_version.as_bytes())?;
|
||||
fs::write(&version_file_path, env!("CARGO_PKG_VERSION")).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user