File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -136,14 +136,25 @@ impl Product {
136136 None => return products,
137137 } ;
138138
139- let src_directory_path = Path :: join ( & module_folder_path, "src" ) ;
139+ let src_directory_path = module_folder_path. join ( "src" ) ;
140+
141+ // 检查 src 目录是否存在
142+ if !src_directory_path. exists ( ) || !src_directory_path. is_dir ( ) {
143+ return products;
144+ }
145+
140146 for target_directory_name in targets_directory_names {
141147 let target_name = if target_directory_name == "default" {
142148 "main" . to_string ( )
143149 } else {
144150 target_directory_name. clone ( )
145151 } ;
146- let target_directory_pathbuf = Path :: join ( & src_directory_path, & target_name) ;
152+ let target_directory_pathbuf = src_directory_path. join ( & target_name) ;
153+
154+ // 检查目标目录是否存在
155+ if !target_directory_pathbuf. exists ( ) || !target_directory_pathbuf. is_dir ( ) {
156+ continue ;
157+ }
147158
148159 let product_directory_path = match Url :: from_directory_path ( & target_directory_pathbuf) {
149160 Ok ( url) => url. to_string ( ) ,
You can’t perform that action at this time.
0 commit comments