Skip to content
Snippets Groups Projects
Commit bf2df313 authored by strentini's avatar strentini
Browse files

OLAT-6362 : prevent archiving empty folders when archiving Task bb

--HG--
branch : uzhFixes711
parent 37761117
No related branches found
No related tags found
No related merge requests found
......@@ -840,10 +840,21 @@ public class TACourseNode extends GenericCourseNode implements AssessableCourseN
}
// copy dropboxes to tmp dir
if (dropboxDir.exists()) {
FileUtils.copyDirContentsToDir(dropboxDir, new File(tmpDirPath + "/dropboxes"),false, "archive task course node dropboxes" );
fileList.add("dropboxes");
//dropboxes exists, so there is something to archive
dataFound = true;
//OLAT-6362 archive only dropboxes of users that handed in at least one file -> prevent empty folders in archive
File[] dropBoxContent = dropboxDir.listFiles();
boolean validDropboxesfound = false;
for (File file : dropBoxContent) {
if(file.isDirectory() && !FileUtils.isDirectoryEmpty(file)){
validDropboxesfound = true;
FileUtils.copyDirContentsToDir(file, new File(tmpDirPath + "/dropboxes/"+file.getName()), false, "archive task course node dropboxes "+file.getName());
}
}
if(validDropboxesfound){
// dropboxes exists and at least one is not empty, so there is something to archive
dataFound = true;
fileList.add("dropboxes");
}
}
// copy only the choosen task to user taskfolder, loop over all users
String taskfolderPath = FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course.getCourseEnvironment(),this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment