Bug 1596769 - Fix broken WebRender capture on Windows r=kvark

On Windows, save the Ctrl-Shift-3 capture to the user's local app data
to make sure we have write permissions.
Verified with ./mach run + capture => saved to C:\Users\...\AppData\Local\wr-capture

Differential Revision: https://phabricator.services.mozilla.com/D53208

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bert Peers 2019-11-15 16:02:56 +00:00
Родитель 30420940bd
Коммит a389b627ed
3 изменённых файлов: 9 добавлений и 0 удалений

1
Cargo.lock сгенерированный
Просмотреть файл

@ -4220,6 +4220,7 @@ dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",

Просмотреть файл

@ -28,6 +28,7 @@ features = ["capture", "serialize_program"]
[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.9"
dirs = "1.0"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.6"

Просмотреть файл

@ -2007,6 +2007,13 @@ pub extern "C" fn wr_api_capture(
}
}
#[cfg(target_os = "windows")]
{
if let Some(storage_path) = dirs::data_local_dir() {
path = PathBuf::from(storage_path).join(path);
}
}
// Increment the extension until we find a fresh path
while path.is_dir() {
let count: u32 = path.extension()