Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ public void run() {
int length = input.readInt();
input.readFully(new byte[length]); // ignore the payload
executePartialSync(context, syncDir);
// delete temporary /sync dir after syncing .xml/.css resources
deleteRecursive(syncDir);
executeRemovedSync(context, removedSyncDir);
// delete temporary /removedsync dir after removing files from the project
deleteRecursive(removedSyncDir);

runtime.runScript(new File(NativeScriptSyncService.this.context.getFilesDir(), "internal/livesync.js"));
try {
Expand Down Expand Up @@ -157,7 +161,11 @@ private void deleteRecursive(File fileOrDirectory) {
}
}

fileOrDirectory.delete();
boolean success = fileOrDirectory.delete();

if (!success && fileOrDirectory.isDirectory()) {
android.util.Log.d("Sync", "Failed to delete temp sync directory: " + fileOrDirectory.getAbsolutePath());
}
}

public static boolean isSyncEnabled(Context context) {
Expand Down
10 changes: 9 additions & 1 deletion test-app/app/src/main/java/com/tns/NativeScriptSyncService.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ public void run() {
int length = input.readInt();
input.readFully(new byte[length]); // ignore the payload
executePartialSync(context, syncDir);
// delete temporary /sync dir after syncing .xml/.css resources
deleteRecursive(syncDir);
executeRemovedSync(context, removedSyncDir);
// delete temporary /removedsync dir after removing files from the project
deleteRecursive(removedSyncDir);

runtime.runScript(new File(NativeScriptSyncService.this.context.getFilesDir(), "internal/livesync.js"));
try {
Expand Down Expand Up @@ -157,7 +161,11 @@ private void deleteRecursive(File fileOrDirectory) {
}
}

fileOrDirectory.delete();
boolean success = fileOrDirectory.delete();

if (!success && fileOrDirectory.isDirectory()) {
android.util.Log.d("Sync", "Failed to delete temp sync directory: " + fileOrDirectory.getAbsolutePath());
}
}

public static boolean isSyncEnabled(Context context) {
Expand Down