Merge branch 'ref/duplicate-code' into 'master'

Ref: directoryManager.getLocalCacheFiles() already provides a list of .wool,...

See merge request sheepitrenderfarm/client!356
This commit is contained in:
Sheepit Renderfarm
2025-01-11 11:14:29 +00:00
2 changed files with 7 additions and 14 deletions

View File

@@ -176,7 +176,7 @@ public class DirectoryManager {
} }
/** /**
* @return a list of archives (files with extensions .zip or .wool) in the * @return a list of archives (files with extension .wool) in the
* working, storage, and shared downloads directories as long as they are not null * working, storage, and shared downloads directories as long as they are not null
*/ */
public List<File> getLocalCacheFiles() { public List<File> getLocalCacheFiles() {

View File

@@ -705,19 +705,12 @@ public class ServerRequest extends Thread {
private String generateXMLForMD5cache() { private String generateXMLForMD5cache() {
List<FileMD5> md5s = new ArrayList<>(); List<FileMD5> md5s = new ArrayList<>();
for (File local_file : this.directoryManager.getLocalCacheFiles()) { for (File local_file : this.directoryManager.getLocalCacheFiles()) {
try { String extension = local_file.getName().substring(local_file.getName().lastIndexOf('.')).toLowerCase();
String extension = local_file.getName().substring(local_file.getName().lastIndexOf('.')).toLowerCase(); String name = local_file.getName().substring(0, local_file.getName().length() - extension.length());
String name = local_file.getName().substring(0, local_file.getName().length() - 1 * extension.length()); FileMD5 fileMD5 = new FileMD5();
if (".wool".equals(extension)) { fileMD5.setMd5(name);
// node_file.setAttribute("md5", name);
FileMD5 fileMD5 = new FileMD5();
fileMD5.setMd5(name);
md5s.add(fileMD5); md5s.add(fileMD5);
}
}
catch (StringIndexOutOfBoundsException e) { // because the file does not have an . its path
}
} }
CacheFileMD5 cache = new CacheFileMD5(); CacheFileMD5 cache = new CacheFileMD5();