Remove saved file's mtime check comparing it with the current time

As the edited file can be a remote file on a server with a different time
zone, the mtime can actually be in the future. In this case the check not
only shows the misleading warning but more importantly the

doc->priv->mtime < st.st_mtime

check never happens and the user doesn't get the modified file prompt.

Setting

doc->priv->mtime = time(NULL);

to the current time on file creation isn't harmful in any way because the
saved file's mtime is taken but it's a bit misleading so better to set it
to 0.
This commit is contained in:
Jiří Techet 2015-08-17 17:06:49 +02:00
parent 1658babe45
commit 3495cf05ab

View File

@ -885,7 +885,7 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft,
#ifdef USE_GIO_FILEMON
monitor_file_setup(doc);
#else
doc->priv->mtime = time(NULL);
doc->priv->mtime = 0;
#endif
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
@ -3617,12 +3617,6 @@ gboolean document_check_disk_status(GeanyDocument *doc, gboolean force)
/* doc may be closed now */
ret = TRUE;
}
else if (! use_gio_filemon && /* ignore check when using GIO */
doc->priv->mtime > cur_time)
{
g_warning("%s: Something is wrong with the time stamps.", G_STRFUNC);
/* Note: on Windows st.st_mtime can be newer than cur_time */
}
else if (doc->priv->mtime < st.st_mtime)
{
/* make sure the user is not prompted again after he cancelled the "reload file?" message */