Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 3ec7029

Browse files
committed
x
1 parent 57b019b commit 3ec7029

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

src/renderer/App.vue

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default {
129129
this.fileIndex = JSON.parse(localStorage.getItem("fileIndex"));
130130
this.dumpScanComplete = true;
131131
this.evaluateFileIndex();
132-
this.initWatchers();
132+
// this.initWatchers();
133133
} else {
134134
this.scanDump();
135135
}
@@ -154,7 +154,7 @@ export default {
154154
// this.scanAll();
155155
},
156156
dirScanComplete() {
157-
this.initWatchers();
157+
// this.initWatchers();
158158
},
159159
currentTask() {
160160
if (this.watcherRunning) {
@@ -164,27 +164,22 @@ export default {
164164
},
165165
methods: {
166166
initWatchers() {
167-
if (this.watcherRunning) return;
168-
setTimeout(() => (this.watchBlocker = false), 15000);
169-
if (process.env.NODE_ENV !== "development")
170-
for (let dir of this.watchDirectories) {
171-
const watcher = chokidar.watch(dir.dir, { persistent: true });
172-
this.watcherRunning = true;
173-
watcher.on("add", async path => {
174-
if (
175-
!this.watchBlocker &&
176-
!this.processing &&
177-
this.dumpScanComplete
178-
) {
179-
console.log("File", path, "has been added");
180-
let arr = path.split("/");
181-
await this.processItem(dir.dir, path, arr[arr.length - 1]);
182-
this.fileIndex = Object.assign({}, this.fileIndex);
183-
this.currentTask = "Waiting for changes...";
184-
}
185-
});
186-
this.currentTask = "Waiting for changes...";
187-
}
167+
// if (this.watcherRunning) return;
168+
// console.log("init watchers");
169+
// for (let dir of this.watchDirectories) {
170+
// const watcher = chokidar.watch(dir.dir, { persistent: true });
171+
// this.watcherRunning = true;
172+
// watcher.on("add", async path => {
173+
// if (!this.watchBlocker && !this.processing && this.dumpScanComplete) {
174+
// console.log("File", path, "has been added");
175+
// let arr = path.split("/");
176+
// await this.processItem(dir.dir, path, arr[arr.length - 1]);
177+
// this.fileIndex = Object.assign({}, this.fileIndex);
178+
// this.currentTask = "Waiting for changes...";
179+
// }
180+
// });
181+
// this.currentTask = "Waiting for changes...";
182+
// }
188183
},
189184
evaluateFileIndex() {
190185
for (let i of Object.keys(this.fileIndex)) {
@@ -247,7 +242,7 @@ export default {
247242
this.dumpScanComplete = true;
248243
this.processing = false;
249244
this.currentTask = `Ready.`;
250-
this.initWatchers();
245+
// this.initWatchers();
251246
resolve();
252247
} catch (e) {
253248
this.processing = false;
@@ -260,7 +255,7 @@ export default {
260255
for (let directory of this.watchDirectories) {
261256
await this.scanDirectory(directory);
262257
}
263-
this.initWatchers();
258+
// this.initWatchers();
264259
this.dirScanComplete = true;
265260
},
266261
scanDirectory(directory) {
@@ -285,7 +280,7 @@ export default {
285280
this.processing = false;
286281
this.totalAnalysed = 0;
287282
this.currentTask = "Scan complete";
288-
this.initWatchers();
283+
// this.initWatchers();
289284
this.fileIndex = Object.assign({}, this.fileIndex);
290285
resolve();
291286
});

src/renderer/components/LandingPage.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
<!-- <button @click="$store.dispatch('toggleDark')">Toggle theme</button> -->
4949
<button v-if="!processing" class="coolbtn margin-vertical" @click="$parent.scanAll">Scan Cache</button>
5050
<button v-else class="coolbtn margin-vertical" @click="processing = false">Abort Tasks</button>
51+
<!-- <button
52+
v-if="!$parent.watcherRunning"
53+
class="coolbtn margin-vertical"
54+
@click="initWatch "
55+
>Watch For Updates</button>
56+
<button v-else class="coolbtn margin-vertical" @click="killWatch">Kill Watcher</button>-->
5157
<br>
5258

5359
<div v-if="foundFiletypes.length > 0" style="opacity:0.3;">Filetypes Discovered</div>
@@ -170,6 +176,14 @@ export default {
170176
}, 30000);
171177
},
172178
methods: {
179+
initWatch() {
180+
this.$parent.watchBlocker = false;
181+
this.$parent.initWatchers();
182+
},
183+
killWatch() {
184+
this.$parent.watchBlocker = true;
185+
this.$parent.watcherRunning = false;
186+
},
173187
reload() {
174188
this.fileIndex = {};
175189
localStorage.clear();

0 commit comments

Comments
 (0)