Skip to content

Commit 8b92d96

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Respect deleted files by livesync command
1 parent 6c5682b commit 8b92d96

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

lib/services/usb-livesync-service.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ export class IOSUsbLiveSyncService implements IiOSUsbLiveSyncService {
217217
return this.$iOSEmulatorServices.postDarwinNotification(this.$iOSNotification.attachRequest);
218218
}
219219

220+
public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<void> {
221+
return (() => {
222+
_.each(localToDevicePaths, localToDevicePathData => {
223+
this.device.fileSystem.deleteFile(localToDevicePathData.getDevicePath(), appIdentifier);
224+
});
225+
}).future<void>()();
226+
}
227+
220228
private sendPageReloadMessage(socket: net.Socket): void {
221229
try {
222230
this.sendPageReloadMessageCore(socket);
@@ -265,7 +273,7 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android
265273

266274
public beforeLiveSyncAction(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {
267275
return (() => {
268-
let deviceRootPath = `/data/local/tmp/${deviceAppData.appIdentifier}`;
276+
let deviceRootPath = this.getDeviceRootPath(deviceAppData.appIdentifier);
269277
this.device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"),
270278
this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"),
271279
this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait();
@@ -279,6 +287,20 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android
279287
}).future<void>()();
280288
}
281289

290+
public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<void> {
291+
return (() => {
292+
let deviceRootPath = this.getDeviceRootPath(appIdentifier);
293+
_.each(localToDevicePaths, localToDevicePathData => {
294+
let deviceFilePath = this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync", helpers.fromWindowsRelativePathToUnix(localToDevicePathData.getRelativeToProjectBasePath()));
295+
this.device.adb.executeShellCommand(["mkdir", "-p", path.dirname(deviceFilePath), "&&", "touch", deviceFilePath]).wait();
296+
})
297+
}).future<void>()();
298+
}
299+
300+
private getDeviceRootPath(appIdentifier: string): string {
301+
return `/data/local/tmp/${appIdentifier}`;
302+
}
303+
282304
private sendPageReloadMessage(): IFuture<void> {
283305
let future = new Future<void>();
284306

0 commit comments

Comments
 (0)