@@ -214,14 +214,22 @@ pub fn prepare_submission(
214
214
let config = plugin. get_exercise_packaging_configuration ( config) ?;
215
215
for path in config. student_file_paths {
216
216
let student_file = project_root. join ( & path) ;
217
- if student_file. exists ( ) {
217
+ if student_file. is_file ( ) {
218
218
file_util:: copy ( student_file, & dest) ?;
219
+ } else if student_file. is_dir ( ) {
220
+ let mut dest = dest. join ( path) ;
221
+ dest. pop ( ) ; // the dest will include the target dir, pop to avoid copying a/b/c to a/b/c/c
222
+ file_util:: copy ( & student_file, dest) ?;
219
223
}
220
224
}
221
225
for path in config. exercise_file_paths {
222
226
let exercise_file = tests_dir. join ( & path) ;
223
- if exercise_file. exists ( ) {
224
- // todo --no-target-directory?
227
+ // todo --no-target-directory?
228
+ if exercise_file. is_file ( ) {
229
+ file_util:: copy ( exercise_file, & dest) ?;
230
+ } else if exercise_file. is_dir ( ) {
231
+ let mut dest = dest. join ( path) ;
232
+ dest. pop ( ) ; // the dest will include the target dir, pop to avoid copying a/b/c to a/b/c/c
225
233
file_util:: copy ( exercise_file, & dest) ?;
226
234
}
227
235
}
0 commit comments