File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
build-artifacts/project-template-gradle/src/main/java/com/tns
test-app/app/src/main/java/com/tns Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ public void run() {
128128 int length = input .readInt ();
129129 input .readFully (new byte [length ]); // ignore the payload
130130 executePartialSync (context , syncDir );
131+ // delete temporary /sync dir after syncing .xml/.css resources
132+ deleteRecursive (syncDir );
131133 executeRemovedSync (context , removedSyncDir );
134+ // delete temporary /removedsync dir after removing files from the project
135+ deleteRecursive (removedSyncDir );
132136
133137 runtime .runScript (new File (NativeScriptSyncService .this .context .getFilesDir (), "internal/livesync.js" ));
134138 try {
@@ -157,7 +161,11 @@ private void deleteRecursive(File fileOrDirectory) {
157161 }
158162 }
159163
160- fileOrDirectory .delete ();
164+ boolean success = fileOrDirectory .delete ();
165+
166+ if (!success && fileOrDirectory .isDirectory ()) {
167+ android .util .Log .d ("Sync" , "Failed to delete temp sync directory: " + fileOrDirectory .getAbsolutePath ());
168+ }
161169 }
162170
163171 public static boolean isSyncEnabled (Context context ) {
Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ public void run() {
128128 int length = input .readInt ();
129129 input .readFully (new byte [length ]); // ignore the payload
130130 executePartialSync (context , syncDir );
131+ // delete temporary /sync dir after syncing .xml/.css resources
132+ deleteRecursive (syncDir );
131133 executeRemovedSync (context , removedSyncDir );
134+ // delete temporary /removedsync dir after removing files from the project
135+ deleteRecursive (removedSyncDir );
132136
133137 runtime .runScript (new File (NativeScriptSyncService .this .context .getFilesDir (), "internal/livesync.js" ));
134138 try {
@@ -157,7 +161,11 @@ private void deleteRecursive(File fileOrDirectory) {
157161 }
158162 }
159163
160- fileOrDirectory .delete ();
164+ boolean success = fileOrDirectory .delete ();
165+
166+ if (!success && fileOrDirectory .isDirectory ()) {
167+ android .util .Log .d ("Sync" , "Failed to delete temp sync directory: " + fileOrDirectory .getAbsolutePath ());
168+ }
161169 }
162170
163171 public static boolean isSyncEnabled (Context context ) {
You can’t perform that action at this time.
0 commit comments