Bug 689403 - GIMP saves files in strange directories when started from an...

If one single directory is passed on the command line, use it
as default folder for the open/save dialogs.
This commit is contained in:
Michael Natterer
2012-12-15 00:34:15 +01:00
parent cc20c8d7f6
commit af7916b3e6
6 changed files with 69 additions and 26 deletions

View File

@ -145,12 +145,34 @@ app_run (const gchar *full_prog_name,
GimpInitStatusFunc update_status_func = NULL;
Gimp *gimp;
GMainLoop *loop;
gchar *default_folder = NULL;
if (filenames && filenames[0] && ! filenames[1] &&
g_file_test (filenames[0], G_FILE_TEST_IS_DIR))
{
if (g_path_is_absolute (filenames[0]))
{
default_folder = g_filename_to_uri (filenames[0], NULL, NULL);
}
else
{
gchar *absolute = g_build_path (G_DIR_SEPARATOR_S,
g_get_current_dir (),
filenames[0],
NULL);
default_folder = g_filename_to_uri (absolute, NULL, NULL);
g_free (absolute);
}
filenames = NULL;
}
/* Create an instance of the "Gimp" object which is the root of the
* core object system
*/
gimp = gimp_new (full_prog_name,
session_name,
default_folder,
be_verbose,
no_data,
no_fonts,