diff --git a/app/Cache.php b/app/Cache.php index 2d1824c..c6abac5 100644 --- a/app/Cache.php +++ b/app/Cache.php @@ -97,11 +97,13 @@ class Cache { * @return bool `true` if the count of files and directories has changed and the cache is updated; `false` otherwise. */ public function changeFile(): bool { - if (isset($this->fileCache[$this->currentDir])) { - if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) { - $this->fileCache = array_merge($this->fileCache, $this->counter); - return true; - } + if (!isset($this->fileCache[$this->currentDir])) { + $this->fileCache[$this->currentDir] = -1; + } + + if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) { + $this->fileCache = array_merge($this->fileCache, $this->counter); + return true; } return false; }