Skip to content

Commit 3dfaaa4

Browse files
committed
fixed a bug involving getting file mod time using Qt's API, native stat handles missing files better...
1 parent 748f9fa commit 3dfaaa4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/DocumentWidget.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,8 +1923,8 @@ void DocumentWidget::CheckForChangesToFileEx() {
19231923
*/
19241924
fileMissing_ = true;
19251925
lastModTime_ = 1;
1926-
dev_ = 0;
1927-
ino_ = 0;
1926+
dev_ = 0;
1927+
ino_ = 0;
19281928

19291929
/* Warn the user, if they like to be warned (Maybe this should be its
19301930
own preference setting: GetPrefWarnFileDeleted()) */
@@ -2801,9 +2801,13 @@ int DocumentWidget::fileWasModifiedExternally() const {
28012801
}
28022802

28032803
QString fullname = FullPath();
2804-
QFileInfo fi(fullname);
28052804

2806-
if (lastModTime_ == fi.lastModified().toTime_t()) {
2805+
struct stat statbuf;
2806+
if (::stat(fullname.toLocal8Bit().data(), &statbuf) != 0) {
2807+
return false;
2808+
}
2809+
2810+
if (lastModTime_ == statbuf.st_mtime) {
28072811
return false;
28082812
}
28092813

0 commit comments

Comments
 (0)