update:server删除由server自己负责

This commit is contained in:
Barry 2019-01-26 20:50:59 +08:00
commit b0c228df02
4 changed files with 18 additions and 34 deletions

View file

@ -14,7 +14,7 @@ public final class DesktopConnection implements Closeable {
private static final int DEVICE_NAME_FIELD_LENGTH = 64;
private static final String SOCKET_NAME = "scrcpy";
private static final String SOCKET_NAME = "qtscrcpy";
private final LocalSocket socket;
private final InputStream inputStream;

View file

@ -2,10 +2,14 @@ package com.genymobile.scrcpy;
import android.graphics.Rect;
import java.io.File;
import java.io.IOException;
public final class Server {
private static final String SERVER_PATH = "/data/local/tmp/scrcpy-server.jar";
private Server() {
// not instantiable
}
@ -82,6 +86,14 @@ public final class Server {
return new Rect(x, y, x + width, y + height);
}
private static void unlinkSelf() {
try {
new File(SERVER_PATH).delete();
} catch (Exception e) {
Ln.e("Cannot unlink server", e);
}
}
public static void main(String... args) throws Exception {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
@ -90,6 +102,7 @@ public final class Server {
}
});
unlinkSelf();
Options options = createOptions(args);
scrcpy(options);
}