summaryrefslogtreecommitdiff
path: root/src/mainwin.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-05-30 20:51:00 (GMT)
committerMarius Kintel <marius@kintel.net>2013-06-06 00:30:48 (GMT)
commit6b16a0f8916c08201353faa8cd116e22b421dc3f (patch)
tree1a7c1782142763ec406de5eff5d23f5ea6b0fc52 /src/mainwin.cc
parent3bb22f9c53b0e0d21ec5845f4b5279f37edb27f3 (diff)
Related to #181, also ignore removal of the main file when auto-reloading
Conflicts: testdata/modulecache-tests/README.txt testdata/modulecache-tests/cascade2.sh
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r--src/mainwin.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc
index b4c1ed5..785aec6 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -1027,7 +1027,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) {
contact: Jan Huwald // Impressum