1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00
audacity/mac/Wrapper.c
Leland Lucius 080b746b66 Revert to using a wrapper when starting Audacity
But, this time use a "C" wrapper as posited by Paul in:

   https://bugzilla.audacityteam.org/show_bug.cgi?id=543#c6

Doing so should bypass the execve()/decontruction issue and
still allow entitlements to work.

This also sets the build system to Legacy so that a "clean"
action will not produce:

   error: Could not delete '...' because it was not created by
          the build system.

And, I'm not sure why the deployment target was 10.9, but it
should have been 10.7.
2020-02-02 02:46:53 -06:00

51 lines
1.2 KiB
C

/**********************************************************************
Audacity: A Digital Audio Editor
Wrapper.c
Audacity(R) is copyright (c) 2020-2020 Audacity Team.
License: GPL v2. See License.txt.
*******************************************************************//**
\file
Give the user more control over where libraries such as FFmpeg get
loaded from.
Since absolute pathnames are used when loading these libraries, the
normal search path would be DYLD_LIBRARY_PATH, absolute path,
DYLD_FALLBACK_LIBRARY_PATH. This means that DYLD_LIBRARY_PATH can
override what the user actually wants.
So, we unset DYLD_LIBRARY_PATH variable and then invoke the main
executable.
*//*******************************************************************/
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static const char audacity[] = "Audacity";
extern char **environ;
int main(int argc, char *argv[])
{
size_t len = strlen(argv[0]);
char *path = alloca(len + sizeof(audacity)); // not precise, but we don't need it to be
strcpy(path, argv[0]);
char *slash = strrchr(path, '/');
if (slash)
{
strcpy(++slash, audacity);
}
unsetenv("DYLD_LIBRARY_PATH");
execve(path, argv, environ);
}