[Github-comments] [geany/geany] Document lost from project files if renamed and reloaded. (Issue #3202)

tycho-kirchner notifications at github.com
Fri May 13 09:08:44 UTC 2022


Hi.
When renaming a file opened in geany with `disk_check_timeout!=0` a prompt is correctly displayed. Renaming it back again, and reloading it (File->Reload) everything *seems* fine. However, if the project is then closed and reopened, that file is gone.
I did not totally verify this, but my educated guess is:
In document.c:monitor_resave_missing_file the `real_path` of the missing is set to null `SETPTR(doc->real_path, NULL);`
Reloading the file does not change this.
In keyfile.c:configuration_save_session_files
`if (doc != NULL && doc->real_path != NULL)`
`real_path` is still null (unless manually saved before), so the file is gone.
Suggested fix (seems to be working):

~~~
 document.c:document_open_file_full
		if (! reload)
		{
			doc = document_create(utf8_filename);
			g_return_val_if_fail(doc != NULL, NULL); /* really should not happen */

			/* file exists on disk, set real_path */
			SETPTR(doc->real_path, utils_get_real_path(locale_filename));

			doc->priv->is_remote = utils_is_remote_path(locale_filename);
			monitor_file_setup(doc);
		} 
+       else {
+			if( doc != NULL ){
+				SETPTR(doc->real_path, utils_get_real_path(locale_filename));
+			}
+		}
~~~

Thanks.
Tycho



-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3202
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/3202 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220513/84878667/attachment.htm>


More information about the Github-comments mailing list