diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java b/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java index 97c8a13f..d82a9a4e 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java @@ -5,13 +5,8 @@ import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; import ru.gravit.launcher.LauncherAPI; import ru.gravit.utils.helper.IOHelper; @@ -148,8 +143,21 @@ public Diff diff(HashedDir other, FileNameMatcher matcher) { return new Diff(mismatch, extra); } public void pushHashedFile(String name, HashedFile file) - { - map.put(name,file); + { //TODO: NOT WORKED + Stack dir_stack = new Stack<>(); + StringTokenizer st = new StringTokenizer(name,"/"); + while(st.hasMoreTokens()) + { + dir_stack.push(st.nextToken()); + } + HashedDir dir; + Map current = map; + while(dir_stack.size() != 1) + { + dir = (HashedDir) current.get(dir_stack.pop()); + current = dir.map; + } + current.put(dir_stack.pop(),file); } public void remove(String name) {