Skip to content
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(capture_webrender): try fallback capture dir #20750

Merged
merged 1 commit into from May 16, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

fix(capture_webrender): try fallback capture dir

  • Loading branch information
kwonoj committed May 5, 2018
commit 1ec078a1e3bfac01e2b88a5cee3ece3e99317171
@@ -1404,17 +1404,24 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}

pub fn capture_webrender(&mut self) {
match env::current_dir() {
Ok(current_dir) => {
let capture_id = now().to_timespec().sec.to_string();
let capture_path = current_dir.join("capture_webrender").join(capture_id);
let revision_file_path = capture_path.join("wr.txt");

if let Err(err) = create_dir_all(&capture_path) {
eprintln!("Unable to create path '{:?}' for capture: {:?}", capture_path, err);
return
let capture_id = now().to_timespec().sec.to_string();
let available_path = [env::current_dir(), Ok(env::temp_dir())].iter()
.filter_map(|val| val.as_ref().map(|dir| dir.join("capture_webrender").join(&capture_id)).ok())
.find(|val| {
match create_dir_all(&val) {
Ok(_) => true,
Err(err) => {
eprintln!("Unable to create path '{:?}' for capture: {:?}", &val, err);
false
}
}
});

match available_path {
Some(capture_path) => {
let revision_file_path = capture_path.join("wr.txt");

debug!("Trying to save webrender capture under {:?}", &revision_file_path);
self.webrender_api.save_capture(capture_path, webrender_api::CaptureBits::all());

match File::create(revision_file_path) {
@@ -1427,7 +1434,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
Err(err) => eprintln!("Capture triggered, creating webrender revision info skipped: {:?}", err)
}
},
Err(err) => eprintln!("Unable to locate path to save captures: {:?}", err)
None => eprintln!("Unable to locate path to save captures")
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.