Skip to content

Commit 976639e

Browse files
committed
minor: incorporate review feedback
1 parent 986f952 commit 976639e

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Artifact {
220220
std::fs::File::open(self.path()?).map_err(Into::into)
221221
}
222222

223-
// check if the artifact exists
223+
// check if the artifact exists in cache
224224
fn exists(&self) -> bool {
225225
self.path().map(|p| p.exists()).unwrap_or(false)
226226
}
@@ -328,7 +328,7 @@ fn build_resource_tar(arts: &ArtifactStore) -> Result<(), anyhow::Error> {
328328
let tar = flate2::write::GzEncoder::new(tar_gz, flate2::Compression::default());
329329
let mut archive = tar::Builder::new(tar);
330330

331-
// decompress the corelib tarball and add "cario/corelib" as "corelib" to the archive
331+
// decompress the corelib tarball and add "cairo/corelib" as "corelib" to the archive
332332
archive.append_dir_all(
333333
DIR_CORELIB,
334334
deflate_artifact(arts.find(RES_CORELIB)?)?

src/resources.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
// This file is generated by build.rs"
1+
// This file is generated by build.rs
2+
// and contains the resources embedded in the binary
23
include!(concat!(env!("OUT_DIR"), "/resources.rs"));
34

4-
pub fn resource_id() -> u64 {
5-
RESOURCE_ID
6-
}
7-
85
pub fn resource_root(uid: u32) -> std::path::PathBuf {
96
std::env::temp_dir().join(format!("stone-cli-{}", uid))
107
}
@@ -13,6 +10,10 @@ pub fn resource_dir(uid: u32) -> std::path::PathBuf {
1310
resource_root(uid).join(format!("{:x}", resource_id()))
1411
}
1512

13+
pub fn resource_id() -> u64 {
14+
RESOURCE_ID
15+
}
16+
1617
pub fn resource_tar() -> &'static [u8] {
1718
RESOURCE_TAR
1819
}

src/setup.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ENV_CONFIGURE: [(&str, &str); 5] = [
2222
];
2323

2424
fn copy_resources(uid: u32, mode: u32) -> anyhow::Result<()> {
25-
// if the flag file exists, return: setup is already done
25+
// if the resource directory already exists, we're done
2626
if resources::resource_dir(uid).exists() {
2727
return Ok(());
2828
}
@@ -98,13 +98,11 @@ pub fn setup() {
9898
let dir = resources::resource_dir(meta.uid());
9999
for (env_name, filename) in ENV_CONFIGURE.iter() {
100100
let full_path = dir.join(filename);
101-
debug_assert!(
101+
assert!(
102102
full_path.exists(), //
103103
"File not found: {:?}",
104104
full_path
105105
);
106-
if std::env::var(env_name).is_err() {
107-
std::env::set_var(env_name, full_path);
108-
}
106+
std::env::set_var(env_name, full_path);
109107
}
110108
}

0 commit comments

Comments
 (0)