|
|
|
|
@ -1604,12 +1604,6 @@ gnc_get_export_filename (SCM choice, GtkWindow *parent)
|
|
|
|
|
filepath = gnc_file_dialog (parent, title, nullptr, default_dir,
|
|
|
|
|
GNC_FILE_DIALOG_EXPORT);
|
|
|
|
|
|
|
|
|
|
if (filepath != nullptr) // test for cancel pressed
|
|
|
|
|
{
|
|
|
|
|
/* Try to test for extension on file name, add if missing */
|
|
|
|
|
if (g_strrstr(filepath, ".") == nullptr)
|
|
|
|
|
filepath = g_strconcat(filepath, ".", g_ascii_strdown(type, strlen(type)), nullptr);
|
|
|
|
|
}
|
|
|
|
|
g_free (type);
|
|
|
|
|
g_free (title);
|
|
|
|
|
g_free (default_dir);
|
|
|
|
|
@ -1617,6 +1611,16 @@ gnc_get_export_filename (SCM choice, GtkWindow *parent)
|
|
|
|
|
if (!filepath)
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
|
|
/* Try to test for extension on file name, add if missing */
|
|
|
|
|
if (strchr (filepath, '.') == nullptr)
|
|
|
|
|
{
|
|
|
|
|
char* extension = g_ascii_strdown (type, -1);
|
|
|
|
|
char* newpath = g_strdup_printf ("%s.%s", filepath, extension);
|
|
|
|
|
g_free (extension);
|
|
|
|
|
g_free (filepath);
|
|
|
|
|
filepath = newpath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default_dir = g_path_get_dirname(filepath);
|
|
|
|
|
gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
|
|
|
|
|
g_free(default_dir);
|
|
|
|
|
|