summaryrefslogtreecommitdiff
path: root/runtime/permissions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r--runtime/permissions.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/permissions.rs b/runtime/permissions.rs
index d98bcc71a..f8385e201 100644
--- a/runtime/permissions.rs
+++ b/runtime/permissions.rs
@@ -605,17 +605,20 @@ impl UnaryPermission<EnvDescriptor> {
pub fn request(&mut self, env: Option<&str>) -> PermissionState {
if let Some(env) = env {
- #[cfg(windows)]
- let env = env.to_uppercase();
+ let env = if cfg!(windows) {
+ env.to_uppercase()
+ } else {
+ env.to_string()
+ };
let state = self.query(Some(&env));
if state == PermissionState::Prompt {
if permission_prompt(&format!("env access to \"{}\"", env)) {
self.granted_list.retain(|env_| env_.0 != env);
- self.granted_list.insert(EnvDescriptor(env.to_string()));
+ self.granted_list.insert(EnvDescriptor(env));
PermissionState::Granted
} else {
self.denied_list.retain(|env_| env_.0 != env);
- self.denied_list.insert(EnvDescriptor(env.to_string()));
+ self.denied_list.insert(EnvDescriptor(env));
self.global_state = PermissionState::Denied;
PermissionState::Denied
}