mirror of https://github.com/mgba-emu/mgba.git
Updater: MacOS fixes
This commit is contained in:
parent
250262bfe7
commit
5c3229b4fa
|
@ -107,6 +107,7 @@ int main(int argc, char* argv[]) {
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
struct mCoreConfig config;
|
struct mCoreConfig config;
|
||||||
char updateArchive[PATH_MAX] = {0};
|
char updateArchive[PATH_MAX] = {0};
|
||||||
|
char bin[PATH_MAX] = {0};
|
||||||
const char* root;
|
const char* root;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
|
||||||
|
@ -131,9 +132,9 @@ int main(int argc, char* argv[]) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
char mountpoint[PATH_MAX];
|
char mountpoint[PATH_MAX];
|
||||||
// Make a slightly random directory name for the updater mountpoint
|
// Make a slightly random directory name for the updater mountpoint
|
||||||
struct timespec t;
|
struct timeval t;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
gettimeofday(&t, NULL);
|
||||||
int printed = snprintf(mountpoint, sizeof(mountpoint), "/Volumes/%s Updater %04lX", projectName, (t.tv_nsec >> 14) & 0xFFFF);
|
int printed = snprintf(mountpoint, sizeof(mountpoint), "/Volumes/%s Updater %04X", projectName, (t.tv_usec >> 2) & 0xFFFF);
|
||||||
|
|
||||||
// Fork hdiutil to mount it
|
// Fork hdiutil to mount it
|
||||||
char* args[] = {"hdiutil", "attach", "-nobrowse", "-mountpoint", mountpoint, updateArchive, NULL};
|
char* args[] = {"hdiutil", "attach", "-nobrowse", "-mountpoint", mountpoint, updateArchive, NULL};
|
||||||
|
@ -181,6 +182,8 @@ int main(int argc, char* argv[]) {
|
||||||
puts("Extracting update");
|
puts("Extracting update");
|
||||||
if (extractArchive(archive, root, prefix)) {
|
if (extractArchive(archive, root, prefix)) {
|
||||||
puts("Complete");
|
puts("Complete");
|
||||||
|
const char* command = mUpdateGetCommand(&config);
|
||||||
|
strlcpy(bin, command, sizeof(bin));
|
||||||
ok = 0;
|
ok = 0;
|
||||||
mUpdateDeregister(&config);
|
mUpdateDeregister(&config);
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,7 +211,6 @@ int main(int argc, char* argv[]) {
|
||||||
unlink(portableIni);
|
unlink(portableIni);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const char* bin = mUpdateGetCommand(&config);
|
|
||||||
mCoreConfigDeinit(&config);
|
mCoreConfigDeinit(&config);
|
||||||
if (ok == 0) {
|
if (ok == 0) {
|
||||||
const char* argv[] = { bin, NULL };
|
const char* argv[] = { bin, NULL };
|
||||||
|
|
Loading…
Reference in New Issue