diff --git a/src/Driver/EioFilesystemDriver.php b/src/Driver/EioFilesystemDriver.php index 2cbb8c2..00cb588 100644 --- a/src/Driver/EioFilesystemDriver.php +++ b/src/Driver/EioFilesystemDriver.php @@ -313,6 +313,10 @@ public function touch(string $path, ?int $modificationTime, ?int $accessTime): v $modificationTime = $modificationTime ?? \time(); $accessTime = $accessTime ?? $modificationTime; + if (!$this->getStatus($path)) { + $this->openFile($path, 'c')->close(); + } + $deferred = new DeferredFuture; $this->poll->listen(); diff --git a/src/Driver/UvFilesystemDriver.php b/src/Driver/UvFilesystemDriver.php index b63e1b3..695bdc3 100644 --- a/src/Driver/UvFilesystemDriver.php +++ b/src/Driver/UvFilesystemDriver.php @@ -363,6 +363,10 @@ public function touch(string $path, ?int $modificationTime, ?int $accessTime): v $modificationTime = $modificationTime ?? \time(); $accessTime = $accessTime ?? $modificationTime; + if (!$this->getStatus($path)) { + $this->openFile($path, 'c')->close(); + } + $deferred = new DeferredFuture; $this->poll->listen(); diff --git a/test/FilesystemDriverTest.php b/test/FilesystemDriverTest.php index e8d61fe..3c05d9a 100644 --- a/test/FilesystemDriverTest.php +++ b/test/FilesystemDriverTest.php @@ -504,6 +504,9 @@ public function testTouch(): void $this->assertTrue($newStat["atime"] > $oldStat["atime"]); $this->assertTrue($newStat["mtime"] > $oldStat["mtime"]); + + $this->driver->touch($touch); + self::assertFileExists($touch); } /**