Fix session-archive on macOS
By default Apple uses a private TMP folder. While mktemp
returns "/tmp/xxx" the canonical path is "/private/tmp/xxx".
This lead to issues when tmp-prefix is removed when building
the session-archive.
See also e52bdc55ad
This commit is contained in:
parent
71f8c8ff38
commit
48556cbd3c
@ -5336,29 +5336,16 @@ Session::archive_session (const std::string& dest,
|
||||
}
|
||||
|
||||
/* create temporary dir to save session to */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
char tmp[256] = "C:\\TEMP\\";
|
||||
GetTempPath (sizeof (tmp), tmp);
|
||||
#else
|
||||
char const* tmp = getenv("TMPDIR");
|
||||
if (!tmp) {
|
||||
tmp = "/tmp/";
|
||||
}
|
||||
#endif
|
||||
if ((strlen (tmp) + 21) > 1024) {
|
||||
GError* err = NULL;
|
||||
char* td = g_dir_make_tmp ("ardourarchive-XXXXXX", &err);
|
||||
|
||||
if (!td) {
|
||||
error << string_compose(_("Could not make tmpdir: %1"), err->message) << endmsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char tmptpl[1024];
|
||||
strcpy (tmptpl, tmp);
|
||||
strcat (tmptpl, "ardourarchive-XXXXXX");
|
||||
char* tmpdir = g_mkdtemp (tmptpl);
|
||||
|
||||
if (!tmpdir) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string to_dir = std::string (tmpdir);
|
||||
const string to_dir = PBD::canonical_path (td);
|
||||
g_free (td);
|
||||
g_clear_error (&err);
|
||||
|
||||
/* switch session directory temporarily */
|
||||
(*_session_dir) = to_dir;
|
||||
|
Loading…
Reference in New Issue
Block a user