File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use ignore::gitignore::Gitignore;
4
4
use mdbook:: errors:: Result ;
5
5
use mdbook:: utils;
6
6
use mdbook:: MDBook ;
7
+ use std:: env;
7
8
use std:: path:: { Path , PathBuf } ;
8
9
use std:: sync:: mpsc:: channel;
9
10
use std:: thread:: sleep;
@@ -87,11 +88,16 @@ fn find_gitignore(book_root: &Path) -> Option<PathBuf> {
87
88
}
88
89
89
90
fn filter_ignored_files ( ignore : Gitignore , paths : & [ PathBuf ] ) -> Vec < PathBuf > {
91
+ let current_dir = env:: current_dir ( ) . expect ( "Unable to determine the current directory" ) ;
92
+
90
93
paths
91
94
. iter ( )
92
95
. filter ( |path| {
96
+ let normalized_path = path
97
+ . strip_prefix ( & current_dir)
98
+ . expect ( "Could not normalize path" ) ;
93
99
!ignore
94
- . matched_path_or_any_parents ( path , path . is_dir ( ) )
100
+ . matched_path_or_any_parents ( normalized_path , normalized_path . is_dir ( ) )
95
101
. is_ignore ( )
96
102
} )
97
103
. map ( |path| path. to_path_buf ( ) )
You can’t perform that action at this time.
0 commit comments