File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,21 @@ impl LanguagePlugin for CSharpPlugin {
132
132
}
133
133
134
134
/// Finds any directory X which contains a X/src/*.csproj file.
135
+ /// Ignores everything in a __MACOSX directory.
135
136
fn find_project_dir_in_zip < R : Read + Seek > (
136
137
zip_archive : & mut ZipArchive < R > ,
137
138
) -> Result < PathBuf , TmcError > {
138
139
for i in 0 ..zip_archive. len ( ) {
139
140
let file = zip_archive. by_index ( i) ?;
140
141
let file_path = Path :: new ( file. name ( ) ) ;
142
+
141
143
if file_path. extension ( ) == Some ( OsStr :: new ( "csproj" ) ) {
142
144
if let Some ( csproj_parent) = file_path. parent ( ) . and_then ( Path :: parent) {
143
145
if csproj_parent. file_name ( ) == Some ( OsStr :: new ( "src" ) ) {
144
146
if let Some ( src_parent) = csproj_parent. parent ( ) {
147
+ if src_parent. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
148
+ continue ;
149
+ }
145
150
return Ok ( src_parent. to_path_buf ( ) ) ;
146
151
}
147
152
}
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ impl LanguagePlugin for RPlugin {
108
108
path. join ( "R" ) . exists ( ) || path. join ( "tests/testthat" ) . exists ( )
109
109
}
110
110
111
+ /// Finds an R directory.
112
+ /// Ignores everything in a __MACOSX directory.
111
113
fn find_project_dir_in_zip < R : Read + Seek > (
112
114
zip_archive : & mut ZipArchive < R > ,
113
115
) -> Result < PathBuf , TmcError > {
@@ -116,12 +118,17 @@ impl LanguagePlugin for RPlugin {
116
118
// so we need to check every path for R
117
119
let file = zip_archive. by_index ( i) ?;
118
120
let file_path = Path :: new ( file. name ( ) ) ;
121
+
119
122
// todo: do in one pass somehow
120
123
if file_path. components ( ) . any ( |c| c. as_os_str ( ) == "R" ) {
121
124
let path: PathBuf = file_path
122
125
. components ( )
123
126
. take_while ( |c| c. as_os_str ( ) != "R" )
124
127
. collect ( ) ;
128
+
129
+ if path. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
130
+ continue ;
131
+ }
125
132
return Ok ( path) ;
126
133
}
127
134
}
Original file line number Diff line number Diff line change @@ -374,6 +374,7 @@ pub trait LanguagePlugin {
374
374
/// Note that the returned path may not actually have an entry in the zip.
375
375
/// The default implementation tries to find a directory that contains a "src" directory,
376
376
/// which may be sufficient for some languages.
377
+ /// Ignores everything in a __MACOSX directory.
377
378
fn find_project_dir_in_zip < R : Read + Seek > (
378
379
zip_archive : & mut ZipArchive < R > ,
379
380
) -> Result < PathBuf , TmcError > {
@@ -382,12 +383,17 @@ pub trait LanguagePlugin {
382
383
// so we need to check every path for src
383
384
let file = zip_archive. by_index ( i) ?;
384
385
let file_path = Path :: new ( file. name ( ) ) ;
386
+
385
387
// todo: do in one pass somehow
386
388
if file_path. components ( ) . any ( |c| c. as_os_str ( ) == "src" ) {
387
389
let path: PathBuf = file_path
388
390
. components ( )
389
391
. take_while ( |c| c. as_os_str ( ) != "src" )
390
392
. collect ( ) ;
393
+
394
+ if path. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
395
+ continue ;
396
+ }
391
397
return Ok ( path) ;
392
398
}
393
399
}
You can’t perform that action at this time.
0 commit comments