Add unzipfx as extra vendored dependency, for CI builds

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-12-29 17:21:06 +00:00
parent 9dc031d5aa
commit 685e62df24
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
36 changed files with 30307 additions and 0 deletions

83
deps/unzipfx/unzipfx/appDetails.c vendored Normal file
View file

@ -0,0 +1,83 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#endif
#include "appDetails.h"
#define CMD_BUF_LEN 1024
static int sfx_app_argc = 0;
static char** sfx_app_argv = NULL;
static char sfx_tmp_path[512] = { 0 };
void sfx_app_set_args(int argc, char** argv)
{
sfx_app_argc = argc;
sfx_app_argv = argv;
}
int sfx_app_autorun_now()
{
int i, cmdBufLen = 0;
char cmdBuf[CMD_BUF_LEN];
const char* const path = sfx_get_tmp_path(1);
chdir(path);
strcpy(cmdBuf, path);
strcat(cmdBuf, SFX_AUTORUN_CMD);
cmdBufLen = strlen(cmdBuf);
for (i=0; i < sfx_app_argc; i++)
{
if (! sfx_app_argv[i])
continue;
cmdBufLen += strlen(sfx_app_argv[i]) + 1;
if (cmdBufLen >= CMD_BUF_LEN-1)
break;
strcat(cmdBuf, " ");
strcat(cmdBuf, sfx_app_argv[i]);
}
puts(SFX_APP_BANNER);
printf("Launching: '%s'\n", cmdBuf);
#ifdef WIN32
ShellExecute(NULL, "open", cmdBuf, NULL, NULL, SW_SHOWNORMAL);
return 0;
#else
const int ret = system(cmdBuf);
exit(ret);
return ret;
#endif
}
char* sfx_get_tmp_path(int withAppName)
{
#ifdef WIN32
GetTempPathA(512 - strlen(DISTRHO_PLUGIN_LABEL), sfx_tmp_path);
if (withAppName == 1)
strcat(sfx_tmp_path, DISTRHO_PLUGIN_LABEL);
#else
char* const tmp = getenv("TMP");
if (tmp)
strcpy(sfx_tmp_path, tmp);
else
strcpy(sfx_tmp_path, "/tmp");
if (withAppName == 1)
strcat(sfx_tmp_path, "/" DISTRHO_PLUGIN_LABEL);
#endif
return sfx_tmp_path;
}

19
deps/unzipfx/unzipfx/appDetails.h vendored Normal file
View file

@ -0,0 +1,19 @@
#ifndef __APP_DETAILS_H__
#define __APP_DETAILS_H__
#include "../../src/Cardinal/DistrhoPluginInfo.h"
#define SFX_APP_BANNER DISTRHO_PLUGIN_NAME " self-contained executable, based on UnZipSFX"
#ifdef WIN32
# define SFX_AUTORUN_CMD "\\" DISTRHO_PLUGIN_LABEL ".exe"
#else
# define SFX_AUTORUN_CMD "/" DISTRHO_PLUGIN_LABEL
#endif
void sfx_app_set_args(int argc, char** argv);
int sfx_app_autorun_now();
char* sfx_get_tmp_path(int withAppName);
#endif // __APP_DETAILS_H__