mirror of
https://github.com/EnderIce2/rpc-bridge.git
synced 2025-05-25 22:14:38 +00:00
Display installation guide prompt for missing temp directory
This commit is contained in:
parent
bf98b8784c
commit
8fbe00b555
52
bridge.c
52
bridge.c
@ -250,32 +250,36 @@ char *native_getenv(const char *name)
|
|||||||
void ConnectToSocket(int fd)
|
void ConnectToSocket(int fd)
|
||||||
{
|
{
|
||||||
print("Connecting to socket\n");
|
print("Connecting to socket\n");
|
||||||
const char *runtime;
|
const char *runtime;
|
||||||
if (IsLinux)
|
if (IsLinux)
|
||||||
runtime = native_getenv("XDG_RUNTIME_DIR");
|
runtime = native_getenv("XDG_RUNTIME_DIR");
|
||||||
else
|
else
|
||||||
runtime = native_getenv("TMPDIR");
|
{
|
||||||
if (runtime == NULL)
|
runtime = native_getenv("TMPDIR");
|
||||||
{
|
if (runtime == NULL)
|
||||||
runtime = "/tmp/rpc-bridge/tmpdir";
|
{
|
||||||
print("IPC directory not set, fallback to /tmp/rpc-bridge/tmpdir\n");
|
runtime = "/tmp/rpc-bridge/tmpdir";
|
||||||
|
print("IPC directory not set, fallback to /tmp/rpc-bridge/tmpdir\n");
|
||||||
|
|
||||||
// Check if the directory exists
|
// Check if the directory exists
|
||||||
DWORD dwAttrib = GetFileAttributes(runtime);
|
DWORD dwAttrib = GetFileAttributes(runtime);
|
||||||
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
|
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
print("IPC directory does not exist: %s. If you're on MacOS, see the github guide on how to install the launchd service.\n", runtime);
|
print("IPC directory does not exist: %s. If you're on MacOS, see the github guide on how to install the launchd service.\n", runtime);
|
||||||
// Handle the case where the directory doesn't exist
|
// Handle the case where the directory doesn't exist
|
||||||
// For example, create the directory
|
// For example, create the directory
|
||||||
if (!RunningAsService)
|
|
||||||
MessageBox(NULL, "IPC directory does not exist",
|
|
||||||
"Directory not found",
|
|
||||||
MB_OK | MB_ICONSTOP);
|
|
||||||
ExitProcess(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print("IPC directory: %s\n", runtime);
|
int result = MessageBox(NULL, "IPC directory does not exist\nDo you want to open the installation guide?",
|
||||||
|
"Directory not found",
|
||||||
|
MB_YESNO | MB_ICONSTOP);
|
||||||
|
if (result == IDYES)
|
||||||
|
ShellExecute(NULL, "open", "https://enderice2.github.io/rpc-bridge/installation.html#macos", NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
ExitProcess(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("IPC directory: %s\n", runtime);
|
||||||
|
|
||||||
/* TODO: check for multiple discord instances and create a pipe for each */
|
/* TODO: check for multiple discord instances and create a pipe for each */
|
||||||
const char *discordUnixPipes[] = {
|
const char *discordUnixPipes[] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user