From 8db531f45f5e4876d7d1416812f71e963f3c5c84 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 23 Mar 2017 13:02:15 +0200 Subject: [PATCH] Fix removing of file on android during livesync When migrating from fibers to promises, we've placed incorrect await, which prevents us when trying to remove a file from project during livesync operation. Fix the code, so removed files will be synced correctly. --- lib/services/livesync/android-device-livesync-service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/services/livesync/android-device-livesync-service.ts b/lib/services/livesync/android-device-livesync-service.ts index d5f7da18ee..0f86b1e390 100644 --- a/lib/services/livesync/android-device-livesync-service.ts +++ b/lib/services/livesync/android-device-livesync-service.ts @@ -67,11 +67,12 @@ class AndroidLiveSyncService implements INativeScriptDeviceLiveSyncService { public async removeFiles(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectId: string): Promise { let deviceRootPath = this.getDeviceRootPath(appIdentifier); - _.each(localToDevicePaths, localToDevicePathData => { + + for (let localToDevicePathData of localToDevicePaths) { let relativeUnixPath = _.trimStart(helpers.fromWindowsRelativePathToUnix(localToDevicePathData.getRelativeToProjectBasePath()), "/"); let deviceFilePath = this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync", relativeUnixPath); - this.device.adb.executeShellCommand(["mkdir", "-p", path.dirname(deviceFilePath), "&& await ", "touch", deviceFilePath]); - }); + await this.device.adb.executeShellCommand(["mkdir", "-p", path.dirname(deviceFilePath), " && ", "touch", deviceFilePath]); + } await this.getDeviceHashService(projectId).removeHashes(localToDevicePaths); }