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 {
132132 }
133133
134134 /// Finds any directory X which contains a X/src/*.csproj file.
135+ /// Ignores everything in a __MACOSX directory.
135136 fn find_project_dir_in_zip < R : Read + Seek > (
136137 zip_archive : & mut ZipArchive < R > ,
137138 ) -> Result < PathBuf , TmcError > {
138139 for i in 0 ..zip_archive. len ( ) {
139140 let file = zip_archive. by_index ( i) ?;
140141 let file_path = Path :: new ( file. name ( ) ) ;
142+
141143 if file_path. extension ( ) == Some ( OsStr :: new ( "csproj" ) ) {
142144 if let Some ( csproj_parent) = file_path. parent ( ) . and_then ( Path :: parent) {
143145 if csproj_parent. file_name ( ) == Some ( OsStr :: new ( "src" ) ) {
144146 if let Some ( src_parent) = csproj_parent. parent ( ) {
147+ if src_parent. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
148+ continue ;
149+ }
145150 return Ok ( src_parent. to_path_buf ( ) ) ;
146151 }
147152 }
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ impl LanguagePlugin for RPlugin {
108108 path. join ( "R" ) . exists ( ) || path. join ( "tests/testthat" ) . exists ( )
109109 }
110110
111+ /// Finds an R directory.
112+ /// Ignores everything in a __MACOSX directory.
111113 fn find_project_dir_in_zip < R : Read + Seek > (
112114 zip_archive : & mut ZipArchive < R > ,
113115 ) -> Result < PathBuf , TmcError > {
@@ -116,12 +118,17 @@ impl LanguagePlugin for RPlugin {
116118 // so we need to check every path for R
117119 let file = zip_archive. by_index ( i) ?;
118120 let file_path = Path :: new ( file. name ( ) ) ;
121+
119122 // todo: do in one pass somehow
120123 if file_path. components ( ) . any ( |c| c. as_os_str ( ) == "R" ) {
121124 let path: PathBuf = file_path
122125 . components ( )
123126 . take_while ( |c| c. as_os_str ( ) != "R" )
124127 . collect ( ) ;
128+
129+ if path. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
130+ continue ;
131+ }
125132 return Ok ( path) ;
126133 }
127134 }
Original file line number Diff line number Diff line change @@ -374,6 +374,7 @@ pub trait LanguagePlugin {
374374 /// Note that the returned path may not actually have an entry in the zip.
375375 /// The default implementation tries to find a directory that contains a "src" directory,
376376 /// which may be sufficient for some languages.
377+ /// Ignores everything in a __MACOSX directory.
377378 fn find_project_dir_in_zip < R : Read + Seek > (
378379 zip_archive : & mut ZipArchive < R > ,
379380 ) -> Result < PathBuf , TmcError > {
@@ -382,12 +383,17 @@ pub trait LanguagePlugin {
382383 // so we need to check every path for src
383384 let file = zip_archive. by_index ( i) ?;
384385 let file_path = Path :: new ( file. name ( ) ) ;
386+
385387 // todo: do in one pass somehow
386388 if file_path. components ( ) . any ( |c| c. as_os_str ( ) == "src" ) {
387389 let path: PathBuf = file_path
388390 . components ( )
389391 . take_while ( |c| c. as_os_str ( ) != "src" )
390392 . collect ( ) ;
393+
394+ if path. components ( ) . any ( |p| p. as_os_str ( ) == "__MACOSX" ) {
395+ continue ;
396+ }
391397 return Ok ( path) ;
392398 }
393399 }
You can’t perform that action at this time.
0 commit comments