Merge pull request #223 from intact/gtk-fix-screenshot-path

Gtk+ Port: Use Desktop or Home as fallback directory for screenshots
This commit is contained in:
zeromus 2018-12-05 14:10:42 -06:00 committed by GitHub
commit 9ea1b5cbda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -2358,6 +2358,7 @@ static void ToggleLayerVisibility(GtkToggleAction* action, gpointer data)
static void Printscreen()
{
GdkPixbuf *screenshot;
const gchar *dir;
gchar *filename, *filen;
GError *error = NULL;
u8 rgb[256 * 384 * 4];
@ -2387,8 +2388,16 @@ static void Printscreen()
NULL,
NULL);
dir = g_get_user_special_dir(G_USER_DIRECTORY_PICTURES);
if (dir == NULL) {
dir = g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
}
if (dir == NULL) {
dir = g_get_home_dir();
}
filen = g_strdup_printf("desmume-screenshot-%d.png", seq);
filename = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_PICTURES), filen, NULL);
filename = g_build_filename(dir, filen, NULL);
gdk_pixbuf_save(screenshot, filename, "png", &error, NULL);
if (error) {