Skip to content

Commit 96d5b59

Browse files
committed
Delete /data/local/tmp/<app-identifier> file if exists on Android device
Livesync does not work when /data/local/tmp/<app-identifier> file exists on Android device. This happens when a file with name app-identifier exists in /data/local/tmp directory on device. In this case CLI is not able to create directory.
1 parent ea53638 commit 96d5b59

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/services/livesync/android-livesync-service.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
3535

3636
public beforeLiveSyncAction(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {
3737
return (() => {
38-
let deviceRootPath = this.getDeviceRootPath(deviceAppData.appIdentifier);
38+
let deviceRootPath = this.getDeviceRootPath(deviceAppData.appIdentifier),
39+
deviceRootDir = path.dirname(deviceRootPath),
40+
deviceRootBasename = path.basename(deviceRootPath),
41+
listResult = this.device.adb.executeShellCommand(["ls", "-l", deviceRootDir]).wait(),
42+
regex = new RegExp(`^-.*${deviceRootBasename}$`, "m"),
43+
matchingFile = (listResult || "").match(regex);
44+
45+
if(matchingFile && matchingFile[0] && _.startsWith(matchingFile[0], '-')){
46+
this.device.adb.executeShellCommand(["rm", "-f", deviceRootPath]).wait();
47+
}
48+
3949
this.device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"),
4050
this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"),
4151
this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait();

0 commit comments

Comments
 (0)