Skip to content

Commit 20bfe75

Browse files
committed
Save the old working directory of the filesystem before process a watch event, and restore it at the end
1 parent b30ff7a commit 20bfe75

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/FireFS/Watcher/FileSystemWatcher.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function setListener(IFileSystemListener $listener): self
178178
*/
179179
public function setPath(string $path): self
180180
{
181-
$this->_path = $path;
181+
$this->_path = $this->_fs->toInternalPath($path);
182182

183183
return $this;
184184
}
@@ -318,9 +318,12 @@ public function start()
318318
*/
319319
public function process()
320320
{
321+
$oldWD = $this->_fs->workingDir();
322+
$this->_fs->setWorkingDir($this->_fs->dirname($this->_path));
321323
clearstatcache(true);
322324
$this->_detectChanges();
323325
$this->_cacheLastModTimes();
326+
$this->_fs->setWorkingDir($oldWD);
324327
}
325328

326329
/**

0 commit comments

Comments
 (0)