Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b777c1181f | |||
f197c1181e |
@ -24,6 +24,7 @@ src = [
|
|||||||
'src/server.c',
|
'src/server.c',
|
||||||
'src/stream.c',
|
'src/stream.c',
|
||||||
'src/video_buffer.c',
|
'src/video_buffer.c',
|
||||||
|
'src/util/file.c',
|
||||||
'src/util/log.c',
|
'src/util/log.c',
|
||||||
'src/util/net.c',
|
'src/util/net.c',
|
||||||
'src/util/process.c',
|
'src/util/process.c',
|
||||||
@ -35,9 +36,15 @@ src = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
src += [ 'src/sys/win/process.c' ]
|
src += [
|
||||||
|
'src/sys/win/file.c',
|
||||||
|
'src/sys/win/process.c',
|
||||||
|
]
|
||||||
else
|
else
|
||||||
src += [ 'src/sys/unix/process.c' ]
|
src += [
|
||||||
|
'src/sys/unix/file.c',
|
||||||
|
'src/sys/unix/process.c',
|
||||||
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
v4l2_support = host_machine.system() == 'linux'
|
v4l2_support = host_machine.system() == 'linux'
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "util/file.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ show_adb_installation_msg() {
|
|||||||
{"pacman", "pacman -S android-tools"},
|
{"pacman", "pacman -S android-tools"},
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < ARRAY_LEN(pkg_managers); ++i) {
|
for (size_t i = 0; i < ARRAY_LEN(pkg_managers); ++i) {
|
||||||
if (search_executable(pkg_managers[i].binary)) {
|
if (sc_file_executable_exists(pkg_managers[i].binary)) {
|
||||||
LOGI("You may install 'adb' by \"%s\"", pkg_managers[i].command);
|
LOGI("You may install 'adb' by \"%s\"", pkg_managers[i].command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "util/file.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/process.h"
|
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
|
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
|
||||||
@ -46,7 +46,7 @@ get_icon_path(void) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char *icon_path = get_local_file_path(SCRCPY_PORTABLE_ICON_FILENAME);
|
char *icon_path = sc_file_get_local_path(SCRCPY_PORTABLE_ICON_FILENAME);
|
||||||
if (!icon_path) {
|
if (!icon_path) {
|
||||||
LOGE("Could not get icon path");
|
LOGE("Could not get icon path");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <SDL2/SDL_platform.h>
|
#include <SDL2/SDL_platform.h>
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
|
#include "util/file.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/net.h"
|
#include "util/net.h"
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
@ -48,7 +49,7 @@ get_server_path(void) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char *server_path = get_local_file_path(SERVER_FILENAME);
|
char *server_path = sc_file_get_local_path(SERVER_FILENAME);
|
||||||
if (!server_path) {
|
if (!server_path) {
|
||||||
LOGE("Could not get local file path, "
|
LOGE("Could not get local file path, "
|
||||||
"using " SERVER_FILENAME " from current directory");
|
"using " SERVER_FILENAME " from current directory");
|
||||||
@ -67,7 +68,7 @@ push_server(const char *serial) {
|
|||||||
if (!server_path) {
|
if (!server_path) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_regular_file(server_path)) {
|
if (!sc_file_is_regular(server_path)) {
|
||||||
LOGE("'%s' does not exist or is not a regular file\n", server_path);
|
LOGE("'%s' does not exist or is not a regular file\n", server_path);
|
||||||
free(server_path);
|
free(server_path);
|
||||||
return false;
|
return false;
|
||||||
|
75
app/src/sys/unix/file.c
Normal file
75
app/src/sys/unix/file.c
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#include "util/file.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
bool
|
||||||
|
sc_file_executable_exists(const char *file) {
|
||||||
|
char *path = getenv("PATH");
|
||||||
|
if (!path)
|
||||||
|
return false;
|
||||||
|
path = strdup(path);
|
||||||
|
if (!path)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
size_t file_len = strlen(file);
|
||||||
|
char *saveptr;
|
||||||
|
for (char *dir = strtok_r(path, ":", &saveptr); dir;
|
||||||
|
dir = strtok_r(NULL, ":", &saveptr)) {
|
||||||
|
size_t dir_len = strlen(dir);
|
||||||
|
char *fullpath = malloc(dir_len + file_len + 2);
|
||||||
|
if (!fullpath)
|
||||||
|
continue;
|
||||||
|
memcpy(fullpath, dir, dir_len);
|
||||||
|
fullpath[dir_len] = '/';
|
||||||
|
memcpy(fullpath + dir_len + 1, file, file_len + 1);
|
||||||
|
|
||||||
|
struct stat sb;
|
||||||
|
bool fullpath_executable = stat(fullpath, &sb) == 0 &&
|
||||||
|
sb.st_mode & S_IXUSR;
|
||||||
|
free(fullpath);
|
||||||
|
if (fullpath_executable) {
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sc_file_get_executable_path(void) {
|
||||||
|
// <https://stackoverflow.com/a/1024937/1987178>
|
||||||
|
#ifdef __linux__
|
||||||
|
char buf[PATH_MAX + 1]; // +1 for the null byte
|
||||||
|
ssize_t len = readlink("/proc/self/exe", buf, PATH_MAX);
|
||||||
|
if (len == -1) {
|
||||||
|
perror("readlink");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
buf[len] = '\0';
|
||||||
|
return strdup(buf);
|
||||||
|
#else
|
||||||
|
// in practice, we only need this feature for portable builds, only used on
|
||||||
|
// Windows, so we don't care implementing it for every platform
|
||||||
|
// (it's useful to have a working version on Linux for debugging though)
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
sc_file_is_regular(const char *path) {
|
||||||
|
struct stat path_stat;
|
||||||
|
|
||||||
|
if (stat(path, &path_stat)) {
|
||||||
|
perror("stat");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return S_ISREG(path_stat.st_mode);
|
||||||
|
}
|
||||||
|
|
@ -3,53 +3,13 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
|
||||||
search_executable(const char *file) {
|
|
||||||
char *path = getenv("PATH");
|
|
||||||
if (!path)
|
|
||||||
return false;
|
|
||||||
path = strdup(path);
|
|
||||||
if (!path)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool ret = false;
|
|
||||||
size_t file_len = strlen(file);
|
|
||||||
char *saveptr;
|
|
||||||
for (char *dir = strtok_r(path, ":", &saveptr); dir;
|
|
||||||
dir = strtok_r(NULL, ":", &saveptr)) {
|
|
||||||
size_t dir_len = strlen(dir);
|
|
||||||
char *fullpath = malloc(dir_len + file_len + 2);
|
|
||||||
if (!fullpath)
|
|
||||||
continue;
|
|
||||||
memcpy(fullpath, dir, dir_len);
|
|
||||||
fullpath[dir_len] = '/';
|
|
||||||
memcpy(fullpath + dir_len + 1, file, file_len + 1);
|
|
||||||
|
|
||||||
struct stat sb;
|
|
||||||
bool fullpath_executable = stat(fullpath, &sb) == 0 &&
|
|
||||||
sb.st_mode & S_IXUSR;
|
|
||||||
free(fullpath);
|
|
||||||
if (fullpath_executable) {
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(path);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum process_result
|
enum process_result
|
||||||
process_execute_redirect(const char *const argv[], pid_t *pid, int *pipe_stdin,
|
process_execute_redirect(const char *const argv[], pid_t *pid, int *pipe_stdin,
|
||||||
int *pipe_stdout, int *pipe_stderr) {
|
int *pipe_stdout, int *pipe_stderr) {
|
||||||
@ -232,37 +192,6 @@ process_close(pid_t pid) {
|
|||||||
process_wait(pid, true); // ignore exit code
|
process_wait(pid, true); // ignore exit code
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
get_executable_path(void) {
|
|
||||||
// <https://stackoverflow.com/a/1024937/1987178>
|
|
||||||
#ifdef __linux__
|
|
||||||
char buf[PATH_MAX + 1]; // +1 for the null byte
|
|
||||||
ssize_t len = readlink("/proc/self/exe", buf, PATH_MAX);
|
|
||||||
if (len == -1) {
|
|
||||||
perror("readlink");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
buf[len] = '\0';
|
|
||||||
return strdup(buf);
|
|
||||||
#else
|
|
||||||
// in practice, we only need this feature for portable builds, only used on
|
|
||||||
// Windows, so we don't care implementing it for every platform
|
|
||||||
// (it's useful to have a working version on Linux for debugging though)
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
is_regular_file(const char *path) {
|
|
||||||
struct stat path_stat;
|
|
||||||
|
|
||||||
if (stat(path, &path_stat)) {
|
|
||||||
perror("stat");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return S_ISREG(path_stat.st_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
read_pipe(int pipe, char *data, size_t len) {
|
read_pipe(int pipe, char *data, size_t len) {
|
||||||
return read(pipe, data, len);
|
return read(pipe, data, len);
|
||||||
|
43
app/src/sys/win/file.c
Normal file
43
app/src/sys/win/file.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "util/file.h"
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "util/log.h"
|
||||||
|
#include "util/str_util.h"
|
||||||
|
|
||||||
|
char *
|
||||||
|
sc_file_get_executable_path(void) {
|
||||||
|
HMODULE hModule = GetModuleHandleW(NULL);
|
||||||
|
if (!hModule) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
WCHAR buf[MAX_PATH + 1]; // +1 for the null byte
|
||||||
|
int len = GetModuleFileNameW(hModule, buf, MAX_PATH);
|
||||||
|
if (!len) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
buf[len] = '\0';
|
||||||
|
return utf8_from_wide_char(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
sc_file_is_regular(const char *path) {
|
||||||
|
wchar_t *wide_path = utf8_to_wide_char(path);
|
||||||
|
if (!wide_path) {
|
||||||
|
LOGC("Could not allocate wide char string");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _stat path_stat;
|
||||||
|
int r = _wstat(wide_path, &path_stat);
|
||||||
|
free(wide_path);
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
perror("stat");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return S_ISREG(path_stat.st_mode);
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
#include "util/process.h"
|
#include "util/process.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
@ -174,40 +173,6 @@ process_close(HANDLE handle) {
|
|||||||
(void) closed;
|
(void) closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
get_executable_path(void) {
|
|
||||||
HMODULE hModule = GetModuleHandleW(NULL);
|
|
||||||
if (!hModule) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
WCHAR buf[MAX_PATH + 1]; // +1 for the null byte
|
|
||||||
int len = GetModuleFileNameW(hModule, buf, MAX_PATH);
|
|
||||||
if (!len) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
buf[len] = '\0';
|
|
||||||
return utf8_from_wide_char(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
is_regular_file(const char *path) {
|
|
||||||
wchar_t *wide_path = utf8_to_wide_char(path);
|
|
||||||
if (!wide_path) {
|
|
||||||
LOGC("Could not allocate wide char string");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct _stat path_stat;
|
|
||||||
int r = _wstat(wide_path, &path_stat);
|
|
||||||
free(wide_path);
|
|
||||||
|
|
||||||
if (r) {
|
|
||||||
perror("stat");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return S_ISREG(path_stat.st_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
read_pipe(HANDLE pipe, char *data, size_t len) {
|
read_pipe(HANDLE pipe, char *data, size_t len) {
|
||||||
DWORD r;
|
DWORD r;
|
||||||
|
48
app/src/util/file.c
Normal file
48
app/src/util/file.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "file.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
|
char *
|
||||||
|
sc_file_get_local_path(const char *name) {
|
||||||
|
char *executable_path = sc_file_get_executable_path();
|
||||||
|
if (!executable_path) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dirname() does not work correctly everywhere, so get the parent
|
||||||
|
// directory manually.
|
||||||
|
// See <https://github.com/Genymobile/scrcpy/issues/2619>
|
||||||
|
char *p = strrchr(executable_path, SC_PATH_SEPARATOR);
|
||||||
|
if (!p) {
|
||||||
|
LOGE("Unexpected executable path: \"%s\" (it should contain a '%c')",
|
||||||
|
executable_path, SC_PATH_SEPARATOR);
|
||||||
|
free(executable_path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*p = '\0'; // modify executable_path in place
|
||||||
|
char *dir = executable_path;
|
||||||
|
size_t dirlen = strlen(dir);
|
||||||
|
size_t namelen = strlen(name);
|
||||||
|
|
||||||
|
size_t len = dirlen + namelen + 2; // +2: '/' and '\0'
|
||||||
|
char *file_path = malloc(len);
|
||||||
|
if (!file_path) {
|
||||||
|
LOGE("Could not alloc path");
|
||||||
|
free(executable_path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(file_path, dir, dirlen);
|
||||||
|
file_path[dirlen] = SC_PATH_SEPARATOR;
|
||||||
|
// namelen + 1 to copy the final '\0'
|
||||||
|
memcpy(&file_path[dirlen + 1], name, namelen + 1);
|
||||||
|
|
||||||
|
free(executable_path);
|
||||||
|
|
||||||
|
return file_path;
|
||||||
|
}
|
||||||
|
|
49
app/src/util/file.h
Normal file
49
app/src/util/file.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef SC_FILE_H
|
||||||
|
#define SC_FILE_H
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# define SC_PATH_SEPARATOR '\\'
|
||||||
|
#else
|
||||||
|
# define SC_PATH_SEPARATOR '/'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
/**
|
||||||
|
* Indicate if an executable exists using $PATH
|
||||||
|
*
|
||||||
|
* In practice, it is only used to know if a package manager is available on
|
||||||
|
* the system. It is only implemented on Linux.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
sc_file_executable_exists(const char *file);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the absolute path of the executable (the scrcpy binary)
|
||||||
|
*
|
||||||
|
* The result must be freed by the caller using free(). It may return NULL on
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
sc_file_get_executable_path(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the absolute path of a file in the same directory as the executable
|
||||||
|
*
|
||||||
|
* The result must be freed by the caller using free(). It may return NULL on
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
sc_file_get_local_path(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate if the file exists and is not a directory
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
sc_file_is_regular(const char *path);
|
||||||
|
|
||||||
|
#endif
|
@ -21,47 +21,6 @@ process_check_success(process_t proc, const char *name, bool close) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
get_local_file_path(const char *name) {
|
|
||||||
char *executable_path = get_executable_path();
|
|
||||||
if (!executable_path) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// dirname() does not work correctly everywhere, so get the parent
|
|
||||||
// directory manually.
|
|
||||||
// See <https://github.com/Genymobile/scrcpy/issues/2619>
|
|
||||||
char *p = strrchr(executable_path, PATH_SEPARATOR);
|
|
||||||
if (!p) {
|
|
||||||
LOGE("Unexpected executable path: \"%s\" (it should contain a '%c')",
|
|
||||||
executable_path, PATH_SEPARATOR);
|
|
||||||
free(executable_path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = '\0'; // modify executable_path in place
|
|
||||||
char *dir = executable_path;
|
|
||||||
size_t dirlen = strlen(dir);
|
|
||||||
size_t namelen = strlen(name);
|
|
||||||
|
|
||||||
size_t len = dirlen + namelen + 2; // +2: '/' and '\0'
|
|
||||||
char *file_path = malloc(len);
|
|
||||||
if (!file_path) {
|
|
||||||
LOGE("Could not alloc path");
|
|
||||||
free(executable_path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(file_path, dir, dirlen);
|
|
||||||
file_path[dirlen] = PATH_SEPARATOR;
|
|
||||||
// namelen + 1 to copy the final '\0'
|
|
||||||
memcpy(&file_path[dirlen + 1], name, namelen + 1);
|
|
||||||
|
|
||||||
free(executable_path);
|
|
||||||
|
|
||||||
return file_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
read_pipe_all(pipe_t pipe, char *data, size_t len) {
|
read_pipe_all(pipe_t pipe, char *data, size_t len) {
|
||||||
size_t copied = 0;
|
size_t copied = 0;
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
// not needed here, but winsock2.h must never be included AFTER windows.h
|
// not needed here, but winsock2.h must never be included AFTER windows.h
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# define PATH_SEPARATOR '\\'
|
|
||||||
# define PRIexitcode "lu"
|
# define PRIexitcode "lu"
|
||||||
// <https://stackoverflow.com/a/44383330/1987178>
|
// <https://stackoverflow.com/a/44383330/1987178>
|
||||||
# define PRIsizet "Iu"
|
# define PRIsizet "Iu"
|
||||||
@ -23,7 +22,6 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# define PATH_SEPARATOR '/'
|
|
||||||
# define PRIsizet "zu"
|
# define PRIsizet "zu"
|
||||||
# define PRIexitcode "d"
|
# define PRIexitcode "d"
|
||||||
# define PROCESS_NONE -1
|
# define PROCESS_NONE -1
|
||||||
@ -73,26 +71,6 @@ process_close(process_t pid);
|
|||||||
bool
|
bool
|
||||||
process_check_success(process_t proc, const char *name, bool close);
|
process_check_success(process_t proc, const char *name, bool close);
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
// only used to find package manager, not implemented for Windows
|
|
||||||
bool
|
|
||||||
search_executable(const char *file);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// return the absolute path of the executable (the scrcpy binary)
|
|
||||||
// may be NULL on error; to be freed by free()
|
|
||||||
char *
|
|
||||||
get_executable_path(void);
|
|
||||||
|
|
||||||
// Return the absolute path of a file in the same directory as he executable.
|
|
||||||
// May be NULL on error. To be freed by free().
|
|
||||||
char *
|
|
||||||
get_local_file_path(const char *name);
|
|
||||||
|
|
||||||
// returns true if the file exists and is not a directory
|
|
||||||
bool
|
|
||||||
is_regular_file(const char *path);
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
read_pipe(pipe_t pipe, char *data, size_t len);
|
read_pipe(pipe_t pipe, char *data, size_t len);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user