~mediascanner-team/mediascanner2/15.04

« back to all changes in this revision

Viewing changes to src/daemon/SubtreeWatcher.cc

  • Committer: CI Train Bot
  • Author(s): James Henstridge
  • Date: 2016-02-25 01:53:30 UTC
  • mfrom: (320.4.3 no-notify-on-unchanged-close)
  • Revision ID: ci-train-bot@canonical.com-20160225015330-we5oyxsklaeoq95n
Don't emit the InvalidateResults signal if a file was opened for writing and then closed, but not actually modified Fixes: #1542175
Approved by: Michi Henning

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
    return true;
169
169
}
170
170
 
171
 
void SubtreeWatcher::fileAdded(const string &abspath) {
 
171
bool SubtreeWatcher::fileAdded(const string &abspath) {
 
172
    bool changed = false;
172
173
    printf("New file was created: %s.\n", abspath.c_str());
173
174
    try {
174
175
        DetectedFile d = p->extractor.detect(abspath);
182
183
            // and the next time this file is encountered, it is skipped.
183
184
            // Insert cleans broken status of the file.
184
185
            p->store.insert(p->extractor.extract(d));
 
186
            changed = true;
185
187
        }
186
188
    } catch(const exception &e) {
187
189
        fprintf(stderr, "Error when adding new file: %s\n", e.what());
188
190
    }
 
191
    return changed;
189
192
}
190
193
 
191
194
void SubtreeWatcher::fileDeleted(const string &abspath) {
250
253
                changed = true;
251
254
            }
252
255
            if(is_file) {
253
 
                fileAdded(abspath);
254
 
                changed = true;
 
256
                changed = fileAdded(abspath);
255
257
            }
256
258
        } else if((event->mask & IN_DELETE) || (event->mask & IN_MOVED_FROM)) {
257
259
            if(p->str2wd.find(abspath) != p->str2wd.end()) {