-
Notifications
You must be signed in to change notification settings - Fork 824
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
Fix windows cache permission #2474
Fix windows cache permission #2474
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! One last question before approving the PR.
scripts/windows-installer/wasmer.iss
Outdated
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_CACHE_DIR"; \ | ||
ValueData: "{app}\cache"; Flags: preservestringtype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not provided, WASMER_CACHE_DIR
will be WASMER_DIR + "/cache"
In this case, I think we should go to the value that worked before:
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_CACHE_DIR"; \ | |
ValueData: "{app}\cache"; Flags: preservestringtype | |
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_CACHE_DIR"; \ | |
ValueData: "{%USERPROFILE}\.wasmer\cache"; Flags: preservestringtype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better not to set a register default value for it on Windows. We can keep the consistent usage style with Unix/Linux OS.
If users want to specify a cache directory, they can set an environment variable WASMER_CACHE_DIR, otherwise, env::temp_dir() will be used and it's safe for caching files.
/// Get the cache dir
pub fn get_cache_dir() -> PathBuf {
match env::var("WASMER_CACHE_DIR") {
Ok(dir) => {
let mut path = PathBuf::from(dir);
path.push(VERSION);
path
}
Err(_) => {
// We use a temporal directory for saving cache files
let mut temp_dir = env::temp_dir();
temp_dir.push("wasmer");
temp_dir.push(VERSION);
temp_dir
}
}
}
What do you think? @syrusakbary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, merging!
bors r+ |
Description
Fix issue #2454 , default
WASMER_CACHE_DIR
is not right for Windows.Add more detailed messages for creating cache directory failure.
close #2454.