ref: 79e4f7b5749f12866a3b63f460d3e51559f1e137
parent: 252fc5e9896155c03e4e8642092589c9b7e4fec3
parent: 425cabffb10a4dad527cbbe7d97d76efbb36a04c
author: Olav Sørensen <olav.sorensen@live.no>
date: Thu Apr 1 07:26:59 EDT 2021
Merge branch 'master' of https://github.com/8bitbubsy/ft2-clone
--- a/src/ft2_audioselector.c
+++ b/src/ft2_audioselector.c
@@ -24,6 +24,9 @@
FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r");
if (f == NULL)
{
+#if defined(__APPLE__)
+ return NULL; // SDL doesn't return devices in any appreciable order, and device 0 is most certainly not guaranteed to be the current default device
+#else
const char *devStringTmp = SDL_GetAudioDeviceName(0, false);
if (devStringTmp == NULL)
{
@@ -35,6 +38,7 @@
if (devStringLen > 0)
strncpy(devString, devStringTmp, MAX_DEV_STR_LEN);
devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
+#endif
}
else
{
@@ -49,6 +53,11 @@
if (devString[devStringLen-1] == '\n')
devString[devStringLen-1] = '\0';
devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
+
+#if defined(__APPLE__)
+ if (devString[0] == '\0')
+ return NULL; // macOS SDL2 locks up indefinitely if fed an empty string for device name
+#endif
fclose(f);
}
--- a/src/ft2_diskop.c
+++ b/src/ft2_diskop.c
@@ -2106,7 +2106,7 @@
}
const int32_t pathLen = (int32_t)UNICHAR_STRLEN(FReq_CurPathU);
- if (pathLen == 0)
+ if (pathLen == 0 && FReq_ModCurPathU[0] != '\0')
{
memset(FReq_CurPathU, 0, (PATH_MAX + 2) * sizeof (UNICHAR));
UNICHAR_STRCPY(FReq_CurPathU, FReq_ModCurPathU);