Browse Source

Tweaks to unzipfx code

tags/1.9.8
falkTX 8 years ago
parent
commit
7ae9396074
4 changed files with 35 additions and 38 deletions
  1. +10
    -12
      data/windows/unzipfx-carla-control/unzipfx/appDetails.c
  2. +5
    -7
      data/windows/unzipfx-carla-control/unzipfx/appDetails.h
  3. +15
    -12
      data/windows/unzipfx-carla/unzipfx/appDetails.c
  4. +5
    -7
      data/windows/unzipfx-carla/unzipfx/appDetails.h

+ 10
- 12
data/windows/unzipfx-carla-control/unzipfx/appDetails.c View File

@@ -25,15 +25,11 @@ int sfx_app_autorun_now()
int i, cmdBufLen = 0;
char cmdBuf[CMD_BUF_LEN];

#ifdef WIN32
strcpy(cmdBuf, sfx_get_tmp_path(1));
strcat(cmdBuf, SFX_AUTORUN_CMD);
#else
strcpy(cmdBuf, "cd ");
strcat(cmdBuf, sfx_get_tmp_path(1));
strcat(cmdBuf, "; ");
const char* const path = sfx_get_tmp_path(1);
chdir(path);

strcpy(cmdBuf, path);
strcat(cmdBuf, SFX_AUTORUN_CMD);
#endif

cmdBufLen = strlen(cmdBuf);

@@ -54,7 +50,9 @@ int sfx_app_autorun_now()
ShellExecute(NULL, "open", cmdBuf, NULL, NULL, SW_SHOWNORMAL);
return 0;
#else
return system(cmdBuf);
const int ret = system(cmdBuf);
exit(ret);
return ret;
#endif
}

@@ -62,10 +60,10 @@ char* sfx_get_tmp_path(int withAppName)
{
#ifdef WIN32
{
GetTempPathA(512 - strlen(SFX_APP_MININAME), sfx_tmp_path);
GetTempPathA(512 - strlen(SFX_APP_MININAME_TITLE), sfx_tmp_path);

if (withAppName == 1)
strcat(sfx_tmp_path, SFX_APP_MININAME);
strcat(sfx_tmp_path, SFX_APP_MININAME_TITLE);
}
#else
{
@@ -77,7 +75,7 @@ char* sfx_get_tmp_path(int withAppName)
strcpy(sfx_tmp_path, "/tmp");

if (withAppName == 1)
strcat(sfx_tmp_path, "/" SFX_APP_MININAME);
strcat(sfx_tmp_path, "/" SFX_APP_MININAME_LCASE);
}
#endif



+ 5
- 7
data/windows/unzipfx-carla-control/unzipfx/appDetails.h View File

@@ -5,17 +5,15 @@
#define REAL_BUILD
#include "../../../../source/includes/CarlaDefines.h"

#define SFX_APP_VERSION CARLA_VERSION_STRING
#define SFX_APP_BANNER "CarlaControl self-contained executable " SFX_APP_VERSION ", based on UnZipSFX."
#define SFX_APP_MININAME_TITLE "CarlaControl"
#define SFX_APP_MININAME_LCASE "carlacontrol"

#ifndef SFX_APP_MININAME
# define SFX_APP_MININAME "CarlaControl"
#endif
#define SFX_APP_BANNER SFX_APP_MININAME_TITLE " self-contained executable " CARLA_VERSION_STRING ", based on UnZipSFX."

#ifdef WIN32
# define SFX_AUTORUN_CMD "\\" SFX_APP_MININAME ".exe"
# define SFX_AUTORUN_CMD "\\" SFX_APP_MININAME_TITLE ".exe"
#else
# define SFX_AUTORUN_CMD "./" SFX_APP_MININAME
# define SFX_AUTORUN_CMD "/" SFX_APP_MININAME_LCASE
#endif

void sfx_app_set_args(int argc, char** argv);


+ 15
- 12
data/windows/unzipfx-carla/unzipfx/appDetails.c View File

@@ -25,15 +25,11 @@ int sfx_app_autorun_now()
int i, cmdBufLen = 0;
char cmdBuf[CMD_BUF_LEN];

#ifdef WIN32
strcpy(cmdBuf, sfx_get_tmp_path(1));
strcat(cmdBuf, SFX_AUTORUN_CMD);
#else
strcpy(cmdBuf, "cd ");
strcat(cmdBuf, sfx_get_tmp_path(1));
strcat(cmdBuf, "; ");
const char* const path = sfx_get_tmp_path(1);
chdir(path);

strcpy(cmdBuf, path);
strcat(cmdBuf, SFX_AUTORUN_CMD);
#endif

cmdBufLen = strlen(cmdBuf);

@@ -54,7 +50,14 @@ int sfx_app_autorun_now()
ShellExecute(NULL, "open", cmdBuf, NULL, NULL, SW_SHOWNORMAL);
return 0;
#else
return system(cmdBuf);
char magicBuf[512];
strcpy(magicBuf, path);
strcat(magicBuf, "magic.mgc");
setenv("CARLA_MAGIC_FILE", magicBuf, 1);

const int ret = system(cmdBuf);
exit(ret);
return ret;
#endif
}

@@ -62,10 +65,10 @@ char* sfx_get_tmp_path(int withAppName)
{
#ifdef WIN32
{
GetTempPathA(512 - strlen(SFX_APP_MININAME), sfx_tmp_path);
GetTempPathA(512 - strlen(SFX_APP_MININAME_TITLE), sfx_tmp_path);

if (withAppName == 1)
strcat(sfx_tmp_path, SFX_APP_MININAME);
strcat(sfx_tmp_path, SFX_APP_MININAME_TITLE);
}
#else
{
@@ -77,7 +80,7 @@ char* sfx_get_tmp_path(int withAppName)
strcpy(sfx_tmp_path, "/tmp");

if (withAppName == 1)
strcat(sfx_tmp_path, "/" SFX_APP_MININAME);
strcat(sfx_tmp_path, "/" SFX_APP_MININAME_LCASE);
}
#endif



+ 5
- 7
data/windows/unzipfx-carla/unzipfx/appDetails.h View File

@@ -5,17 +5,15 @@
#define REAL_BUILD
#include "../../../../source/includes/CarlaDefines.h"

#define SFX_APP_VERSION CARLA_VERSION_STRING
#define SFX_APP_BANNER "Carla self-contained executable " SFX_APP_VERSION ", based on UnZipSFX."
#define SFX_APP_MININAME_TITLE "Carla"
#define SFX_APP_MININAME_LCASE "carla"

#ifndef SFX_APP_MININAME
# define SFX_APP_MININAME "Carla"
#endif
#define SFX_APP_BANNER SFX_APP_MININAME_TITLE " self-contained executable " CARLA_VERSION_STRING ", based on UnZipSFX."

#ifdef WIN32
# define SFX_AUTORUN_CMD "\\" SFX_APP_MININAME ".exe"
# define SFX_AUTORUN_CMD "\\" SFX_APP_MININAME_TITLE ".exe"
#else
# define SFX_AUTORUN_CMD "./" SFX_APP_MININAME
# define SFX_AUTORUN_CMD "/" SFX_APP_MININAME_LCASE
#endif

void sfx_app_set_args(int argc, char** argv);


Loading…
Cancel
Save