File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ impl NavdataDownloader {
158
158
) ) ;
159
159
return ;
160
160
}
161
-
161
+
162
162
let path = PathBuf :: from ( format ! ( "\\ work/navdata/{}" , folder) ) ;
163
163
// If the directory exists, delete it
164
164
if util:: path_exists ( & path) {
Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ impl<R: io::Read + io::Seek> ZipFileHandler<R> {
44
44
None => continue ,
45
45
} ;
46
46
47
+ // Check how many times "." appears in the file name
48
+ let dot_count = outpath. to_str ( ) . unwrap_or_default ( ) . matches ( '.' ) . count ( ) ;
49
+ // Skip if there are more than 1 "." in the file name (MSFS crashes if we try to extract these files for some reason)
50
+ if dot_count > 1 {
51
+ self . current_file_index += 1 ;
52
+ continue ;
53
+ }
54
+
47
55
if ( * file. name ( ) ) . ends_with ( '/' ) {
48
56
fs:: create_dir_all ( outpath) . unwrap ( ) ;
49
57
} else {
Original file line number Diff line number Diff line change @@ -15,9 +15,19 @@ pub fn get_path_type(path: &Path) -> PathType {
15
15
if file_res. is_ok ( ) {
16
16
return PathType :: File ;
17
17
}
18
- let dir_res = fs:: read_dir ( path) ;
19
- if dir_res. is_ok ( ) {
20
- return PathType :: Directory ;
18
+ let mut dir_res = match fs:: read_dir ( path) {
19
+ Ok ( dir_res) => dir_res,
20
+ Err ( _) => {
21
+ return PathType :: DoesNotExist ;
22
+ }
23
+ } ;
24
+
25
+ let next = dir_res. next ( ) ;
26
+
27
+ if next. is_some ( ) {
28
+ if next. unwrap ( ) . is_ok ( ) {
29
+ return PathType :: Directory ;
30
+ }
21
31
}
22
32
PathType :: DoesNotExist
23
33
}
@@ -43,4 +53,4 @@ pub fn delete_folder_recursively(path: &Path) -> io::Result<()> {
43
53
}
44
54
fs:: remove_dir ( path) ?;
45
55
Ok ( ( ) )
46
- }
56
+ }
You can’t perform that action at this time.
0 commit comments