diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-30 20:51:00 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-30 20:51:00 (GMT) |
commit | 06237a067fb124be1e8ead8fe54d1098a083734f (patch) | |
tree | 84bf4ea3b22409119d3f6fc23cdba3f55f6510bd /src/mainwin.cc | |
parent | 0041f3012d8a401c9e2750ed08fe4e5ce80eb4a9 (diff) |
Related to #181, also ignore removal of the main file when auto-reloading
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 788f824..eedd3a5 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1106,7 +1106,10 @@ bool MainWindow::fileChangedOnDisk() if (!this->fileName.isEmpty()) { struct stat st; memset(&st, 0, sizeof(struct stat)); - stat(this->fileName.toLocal8Bit(), &st); + bool valid = (stat(this->fileName.toLocal8Bit(), &st) == 0); + // If file isn't there, just return and use current editor text + if (!valid) return false; + std::string newid = str(boost::format("%x.%x") % st.st_mtime % st.st_size); if (newid != this->autoReloadId) { |