Skip to content

Commit f8cd9bb

Browse files
jyn514Joshua Nelson
authored and
Joshua Nelson
committed
Fix bug in copy_doc_dir
Before, it would append `doc/` on every recursive call. This moves the responsibility of adding `doc/` to the caller.
1 parent 01f2a26 commit f8cd9bb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/docbuilder/rustwide_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl RustwideBuilder {
509509
target: &str,
510510
is_default_target: bool,
511511
) -> Result<()> {
512-
let source = target_dir.join(target);
512+
let source = target_dir.join(target).join("doc");
513513

514514
let mut dest = local_storage.to_path_buf();
515515
// only add target name to destination directory when we are copying a non-default target.

src/utils/copy.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use regex::Regex;
1313
/// Target directory must have doc directory.
1414
///
1515
/// This function is designed to avoid file duplications.
16-
pub fn copy_doc_dir<P: AsRef<Path>>(target: P, destination: P) -> Result<()> {
17-
let source = PathBuf::from(target.as_ref()).join("doc");
16+
pub fn copy_doc_dir<P: AsRef<Path>>(source: P, destination: P) -> Result<()> {
1817
let destination = destination.as_ref().to_path_buf();
1918

2019
// Make sure destination directory exists
@@ -27,7 +26,7 @@ pub fn copy_doc_dir<P: AsRef<Path>>(target: P, destination: P) -> Result<()> {
2726
r"(\.lock|\.txt|\.woff|\.svg|\.css|main-.*\.css|main-.*\.js|normalize-.*\.js|rustdoc-.*\.css|storage-.*\.js|theme-.*\.js)$")
2827
.unwrap();
2928

30-
for file in source.read_dir()? {
29+
for file in source.as_ref().read_dir()? {
3130

3231
let file = file?;
3332
let mut destination_full_path = PathBuf::from(&destination);

0 commit comments

Comments
 (0)