]> git.proxmox.com Git - cargo.git/commitdiff
Make `cargo doc --open --target TARGET` work as expected.
authorKang Seonghoon <public+git@mearie.org>
Sat, 13 Aug 2016 21:30:02 +0000 (06:30 +0900)
committerKang Seonghoon <public+git@mearie.org>
Sat, 13 Aug 2016 21:30:02 +0000 (06:30 +0900)
src/cargo/ops/cargo_doc.rs

index b764be1a2e99bbc8f6a02f7d9fcbb580e9798505..2ce18102a1b7b70b43431d82a0dfdce289bdf67b 100644 (file)
@@ -53,7 +53,10 @@ pub fn doc(ws: &Workspace,
         // Don't bother locking here as if this is getting deleted there's
         // nothing we can do about it and otherwise if it's getting overwritten
         // then that's also ok!
-        let target_dir = ws.target_dir();
+        let mut target_dir = ws.target_dir();
+        if let Some(triple) = options.compile_opts.target {
+            target_dir.push(Path::new(triple).file_stem().unwrap());
+        }
         let path = target_dir.join("doc").join(&name).join("index.html");
         let path = path.into_path_unlocked();
         if fs::metadata(&path).is_ok() {