You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use rfd::{FileDialog,MessageButtons,MessageDialog,MessageLevel};
133
-
use std::io::ErrorKind;
134
-
135
-
let path = processed_url.to_file_path().unwrap_or_default();
136
-
137
-
fs::read(path.clone()).or_else(|e| {
138
-
ifmatches!(e.kind(),ErrorKind::PermissionDenied){
139
-
letmut display_dir = path.clone();
140
-
141
-
display_dir.pop();
126
+
fs::read(&path).or_else(|e| {
127
+
ifcfg!(feature = "sandbox"){
128
+
use rfd::{FileDialog,MessageButtons,MessageDialog,MessageLevel};
129
+
use std::io::ErrorKind;
142
130
143
-
let attempt_sandbox_open = MessageDialog::new()
144
-
.set_level(MessageLevel::Warning)
145
-
.set_description(&format!("The current movie is attempting to read files stored in {}.\n\nTo allow it to do so, click Yes, and then Open to grant read access to that directory.\n\nOtherwise, click No to deny access.", display_dir.into_os_string().to_string_lossy()))
146
-
.set_buttons(MessageButtons::YesNo)
147
-
.show();
131
+
if e.kind() == ErrorKind::PermissionDenied{
132
+
let attempt_sandbox_open = MessageDialog::new()
133
+
.set_level(MessageLevel::Warning)
134
+
.set_description(&format!("The current movie is attempting to read files stored in {}.\n\nTo allow it to do so, click Yes, and then Open to grant read access to that directory.\n\nOtherwise, click No to deny access.", path.parent().unwrap().to_string_lossy()))
0 commit comments