@eht16 commented on this pull request.


In plugins/saveactions.c:

>  		gchar *new_filename;
 		gint fd;
 		GeanyFiletype *ft = doc->file_type;
 
-		fd = g_file_open_tmp("gis_XXXXXX", &new_filename, NULL);
+		directory = !EMPTY(instantsave_target_dir) ? instantsave_target_dir : g_get_tmp_dir();
+		new_filename = g_build_filename(directory, "gis_XXXXXX", NULL);
+		fd = g_mkstemp(new_filename);
 		if (fd != -1)
 			close(fd); /* close the returned file descriptor as we only need the filename */
 

If g_mkstemp() returns -1 is the filename valid and usable?

As per docs, no. So we handle now errors by showing them to the user and cancelling Instant Save.

Also since g_mkstemp() makes a file the now non-temporary file directory gets two files, for example gis_setv00 and gis_setv00.c.

Good catch! Fixed by first constructing the final filename and then call g_mkstemp() to have the file created.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.