Skip to content

Commit 269aad0

Browse files
Plamen5kovatanasovg
authored andcommitted
removes synced files from src folder after sync
1 parent f2ab37b commit 269aad0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/src/com/tns/NativeScriptSyncHelper.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,35 @@ public static void sync(Context context)
7979
if (fullSyncDir.exists())
8080
{
8181
executeFullSync(context, fullSyncDir);
82+
deleteRecursive(fullSyncDir);
8283
return;
8384
}
8485

8586
File syncDir = new File(syncPath);
8687
if (syncDir.exists())
8788
{
88-
executePartialSync(context, syncDir);
89+
executePartialSync(context, syncDir);
90+
deleteRecursive(syncDir);
8991
}
9092

9193
File removedSyncDir = new File(removedSyncPath);
9294
if (removedSyncDir.exists())
9395
{
9496
executeRemovedSync(context, removedSyncDir);
97+
deleteRecursive(removedSyncDir);
9598
}
9699
}
100+
101+
private static void deleteRecursive(File fileOrDirectory) {
102+
103+
if (fileOrDirectory.isDirectory()){
104+
for (File child : fileOrDirectory.listFiles()){
105+
deleteRecursive(child);
106+
}
107+
}
108+
109+
fileOrDirectory.delete();
110+
}
97111

98112
private static boolean getShouldExecuteSync(Context context)
99113
{

0 commit comments

Comments
 (0)