From 338d0bb0878c326e21f10e82599191ae2bcc4195 Mon Sep 17 00:00:00 2001 From: James Kominick Date: Thu, 27 Jul 2017 20:36:29 -0400 Subject: [PATCH] issue #2 | move temp working dir - Move the temp dir to the same directory of the current executable since `std::fs::rename` requires `to` and `from` to be on the same filesystem. --- src/backends/github.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backends/github.rs b/src/backends/github.rs index 705807c..b0e92bb 100644 --- a/src/backends/github.rs +++ b/src/backends/github.rs @@ -280,7 +280,9 @@ impl Updater { prompt_ok("Do you want to continue? [Y/n] ")?; } - let tmp_dir = tempdir::TempDir::new(&format!("__{}-download", self.bin_name))?; + let tmp_dir_parent = self.bin_install_path.parent() + .expect(&format!("Failed to determine parent dir of `bin_install_path`: {:?}", self.bin_install_path)); + let tmp_dir = tempdir::TempDir::new_in(&tmp_dir_parent, &format!("{}_download", self.bin_name))?; let tmp_tarball_path = tmp_dir.path().join(&target_asset.name); let mut tmp_tarball = fs::File::create(&tmp_tarball_path)?;