diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-05-07 16:14:18 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-05-07 16:24:51 +0100 |
commit | c56642819eed87431dff3446fe111f7f3eefaa7d (patch) | |
tree | 397126ca4baac425f9c1c44f3d5c56c681e2c4fe /gtk/dialogs | |
parent | c1e2da80dfa62793ea107cf12408c814e268a54b (diff) | |
download | netsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.gz netsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.bz2 |
add file operations table and make all frontends use it.
This rationalises the path construction and basename file
operations. The default implementation is POSIX which works for all
frontends except windows, riscos and amiga which have differeing path
separators and rules.
These implementations are significantly more robust than the previous
nine implementations and also do not use unsafe strncpy or buffers
with arbitrary length limits.
These implementations also carry full documentation comments.
Diffstat (limited to 'gtk/dialogs')
-rw-r--r-- | gtk/dialogs/preferences.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c index fcf30c8fa..d36d0c68b 100644 --- a/gtk/dialogs/preferences.c +++ b/gtk/dialogs/preferences.c @@ -19,12 +19,12 @@ #include <stdint.h> #include <math.h> -#include "utils/filepath.h" -#include "utils/log.h" #include "utils/utils.h" #include "utils/messages.h" -#include "desktop/browser.h" #include "utils/nsoption.h" +#include "utils/file.h" +#include "utils/log.h" +#include "desktop/browser.h" #include "desktop/searchweb.h" #include "gtk/compat.h" @@ -1002,10 +1002,10 @@ nsgtk_preferences_fileChooserDownloads_realize(GtkWidget *widget, G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_response(GtkDialog *dlg, gint resid) { - char *choices; + char *choices = NULL; if (resid == GTK_RESPONSE_CLOSE) { - choices = filepath_append(nsgtk_config_home, "Choices"); + netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices"); if (choices != NULL) { nsoption_write(choices, NULL, NULL); free(choices); @@ -1018,9 +1018,9 @@ G_MODULE_EXPORT gboolean nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg, struct ppref *priv) { - char *choices; + char *choices = NULL; - choices = filepath_append(nsgtk_config_home, "Choices"); + netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices"); if (choices != NULL) { nsoption_write(choices, NULL, NULL); free(choices); @@ -1037,9 +1037,9 @@ nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg, G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_destroy(GtkDialog *dlg, struct ppref *priv) { - char *choices; + char *choices = NULL; - choices = filepath_append(nsgtk_config_home, "Choices"); + netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices"); if (choices != NULL) { nsoption_write(choices, NULL, NULL); free(choices); |