Commit 890310eb authored by Albert Gräf's avatar Albert Gräf
Browse files

Save the defaults on OSX if the user prefs don't exist yet, in order to avoid...

Save the defaults on OSX if the user prefs don't exist yet, in order to avoid losing them later when saving the recent files list (fixes #339).
parent acd148a5
...@@ -268,6 +268,8 @@ static char *sys_prefbuf; ...@@ -268,6 +268,8 @@ static char *sys_prefbuf;
// prefs is *much* faster now than with the previous method which invoked // prefs is *much* faster now than with the previous method which invoked
// 'defaults read' on each individual key. // 'defaults read' on each individual key.
static int save_prefs_later = 0;
static void sys_initloadpreferences(void) static void sys_initloadpreferences(void)
{ {
char cmdbuf[MAXPDSTRING], *buf; char cmdbuf[MAXPDSTRING], *buf;
...@@ -308,6 +310,8 @@ static void sys_initloadpreferences(void) ...@@ -308,6 +310,8 @@ static void sys_initloadpreferences(void)
// Read from the package defaults and write to the user prefs. // Read from the package defaults and write to the user prefs.
prefs = default_prefs; prefs = default_prefs;
strncpy(current_prefs, user_prefs, FILENAME_MAX); strncpy(current_prefs, user_prefs, FILENAME_MAX);
// AG: Remember to save the prefs later after we loaded them (see below).
save_prefs_later = 1;
} }
// This looks complicated, but is rather straightforward. The individual // This looks complicated, but is rather straightforward. The individual
// stages of the pipe are: // stages of the pipe are:
...@@ -405,6 +409,14 @@ static void sys_doneloadpreferences( void) ...@@ -405,6 +409,14 @@ static void sys_doneloadpreferences( void)
if (sys_prefbuf) if (sys_prefbuf)
free(sys_prefbuf); free(sys_prefbuf);
sys_prefbuf = NULL; sys_prefbuf = NULL;
if (save_prefs_later) {
// AG: We need to save the default prefs to the user prefs at this point
// in order to avoid losing them, in case the recent file list is written
// without first saving the defaults (fixes #339).
extern void glob_savepreferences(t_pd *dummy);
glob_savepreferences(NULL);
save_prefs_later = 0;
}
} }
// AG: We use a similar approach here to import the data into the defaults // AG: We use a similar approach here to import the data into the defaults
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment