From 358da57394524e120f680a8b644a3d1211e74b56 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 13 Nov 2015 18:30:36 +0200 Subject: [PATCH] Respect deleted files by livesync command --- lib/common | 2 +- lib/services/usb-livesync-service.ts | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/common b/lib/common index 7ee22324d2..ee56ac69e0 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 7ee22324d20cc83ea44f58f85d0118c8b9f511b2 +Subproject commit ee56ac69e000745ecf1cd978e4ade4792d92f66a diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 321eab9f0f..a478bb462b 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -217,6 +217,14 @@ export class IOSUsbLiveSyncService implements IiOSUsbLiveSyncService { return this.$iOSEmulatorServices.postDarwinNotification(this.$iOSNotification.attachRequest); } + public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture { + return (() => { + _.each(localToDevicePaths, localToDevicePathData => { + this.device.fileSystem.deleteFile(localToDevicePathData.getDevicePath(), appIdentifier); + }); + }).future()(); + } + private sendPageReloadMessage(socket: net.Socket): void { try { this.sendPageReloadMessageCore(socket); @@ -265,7 +273,7 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android public beforeLiveSyncAction(deviceAppData: Mobile.IDeviceAppData): IFuture { return (() => { - let deviceRootPath = `/data/local/tmp/${deviceAppData.appIdentifier}`; + let deviceRootPath = this.getDeviceRootPath(deviceAppData.appIdentifier); this.device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait(); @@ -279,6 +287,21 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android }).future()(); } + public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture { + return (() => { + let deviceRootPath = this.getDeviceRootPath(appIdentifier); + _.each(localToDevicePaths, localToDevicePathData => { + let relativeUnixPath = _.trimLeft(helpers.fromWindowsRelativePathToUnix(localToDevicePathData.getRelativeToProjectBasePath()), "/"); + let deviceFilePath = this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync", relativeUnixPath); + this.device.adb.executeShellCommand(["mkdir", "-p", path.dirname(deviceFilePath), "&&", "touch", deviceFilePath]).wait(); + }); + }).future()(); + } + + private getDeviceRootPath(appIdentifier: string): string { + return `/data/local/tmp/${appIdentifier}`; + } + private sendPageReloadMessage(): IFuture { let future = new Future();