diff --git a/src/com/olexyn/ensync/Main.java b/src/com/olexyn/ensync/Main.java index 1bf8a43..423f17c 100644 --- a/src/com/olexyn/ensync/Main.java +++ b/src/com/olexyn/ensync/Main.java @@ -18,7 +18,7 @@ public class Main { SyncEntity syncEntity = new SyncEntity("test"); syncEntity.addDirectory("/home/user/test/a"); syncEntity.addDirectory("/home/user/test/b"); - syncEntity.addDirectory("/home/user/test/c"); + //syncEntity.addDirectory("/home/user/test/c"); int br1 = 0; @@ -32,6 +32,10 @@ public class Main { syncDirectory.updateStateFileNew(); syncDirectory.updatePoolNew(); + syncDirectory.getListCreated(); + syncDirectory.getListDeleted(); + + // syncDirectory.doSyncOps(); @@ -44,8 +48,11 @@ public class Main { // -> create newFile -> update StateFileNew-> getListCreated contains newFile -> addToMapCreated -> create copies as needed -> updateStateFileOld -> OK // -> create newFile -> update StateFileOld -> getListDeletd contains newFile -> VERY BAD // + syncDirectory.updateStateFileNew(); + syncDirectory.updatePoolNew(); + syncDirectory.updateStateFileOld(); - syncDirectory.updatePoolBoth(); + syncDirectory.updatePoolOld(); diff --git a/src/com/olexyn/ensync/artifacts/SyncDirectory.java b/src/com/olexyn/ensync/artifacts/SyncDirectory.java index 3bae22d..fe779d3 100644 --- a/src/com/olexyn/ensync/artifacts/SyncDirectory.java +++ b/src/com/olexyn/ensync/artifacts/SyncDirectory.java @@ -110,7 +110,7 @@ public class SyncDirectory { public Map getPoolOld() { if (poolOld.isEmpty()) { - updatePoolBoth(); + updatePoolOld(); } return poolOld; } @@ -118,8 +118,8 @@ public class SyncDirectory { /** * UPDATE PoolOld FROM contents of StateFileOld. */ - public void updatePoolBoth() { - poolNew = tools.fileToPool(getStateFileNew(), "all"); + public void updatePoolOld() { + poolOld = tools.fileToPool(getStateFileOld(), "all"); } @@ -152,7 +152,7 @@ public class SyncDirectory { } public void updateListCreated(){ - if (state.equals("")) + listCreated = tools.mapMinus(getPoolNew(), getPoolOld()); } @@ -180,7 +180,7 @@ public class SyncDirectory { - for (File createdFile : this.getListCreated()) { + for (File createdFile : listCreated) { for (Map.Entry otherEntry : syncEntity.syncDirectories.entrySet()) { SyncDirectory otherSyncDirectory = otherEntry.getValue(); @@ -210,7 +210,7 @@ public class SyncDirectory { } // - for (File deletedFile : this.getListDeleted()) { + for (File deletedFile : listDeleted) { for (Map.Entry otherEntry : syncEntity.syncDirectories.entrySet()) { SyncDirectory otherSyncDirectory = otherEntry.getValue();