diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-02-11 11:04:30 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-02-11 11:04:30 +0000 |
commit | 49ec933f2bfc8c8d060f64ec5d95e4c4ff984b1d (patch) | |
tree | e991b41c8679840de12c00f104d02e13b3b744aa /epan/uat.c | |
parent | 3c9e4d5de9f95b0c3e047262cae0342ca5bd3864 (diff) |
The uat files can be saved before any other preferences, so try creating
the personal configuration directory if saving the uat file fails.
svn path=/trunk/; revision=27424
Diffstat (limited to 'epan/uat.c')
-rw-r--r-- | epan/uat.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/epan/uat.c b/epan/uat.c index c4212be3a1..bcb3558db3 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -248,6 +248,17 @@ gboolean uat_save(uat_t* uat, char** error) { fp = ws_fopen(fname,"w"); + if (!fp && errno == ENOENT) { + /* Parent directory does not exist, try creating first */ + gchar *pf_dir_path = NULL; + if (create_persconffile_dir(&pf_dir_path) != 0) { + *error = ep_strdup_printf("uat_save: error creating '%s'", pf_dir_path); + g_free (pf_dir_path); + return FALSE; + } + fp = ws_fopen(fname,"w"); + } + if (!fp) { *error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno)); return FALSE; |