mirror of
https://github.com/danog/file.git
synced 2024-11-26 20:04:51 +01:00
Don't fail if directory exists on recursive creation
This commit is contained in:
parent
a631384d3e
commit
b8e3314417
@ -233,6 +233,13 @@ final class EioFilesystemDriver implements FilesystemDriver
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$deferred->getFuture()->await();
|
$deferred->getFuture()->await();
|
||||||
|
} catch (FilesystemException $exception) {
|
||||||
|
$result = $this->getStatus($path);
|
||||||
|
if ($result !== null && ($result['mode'] & 0040000)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $exception;
|
||||||
} finally {
|
} finally {
|
||||||
$this->poll->done();
|
$this->poll->done();
|
||||||
}
|
}
|
||||||
|
@ -266,6 +266,13 @@ final class UvFilesystemDriver implements FilesystemDriver
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$deferred->getFuture()->await();
|
$deferred->getFuture()->await();
|
||||||
|
} catch (FilesystemException $exception) {
|
||||||
|
$result = $this->getStatus($path);
|
||||||
|
if ($result !== null && ($result['mode'] & 0040000)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $exception;
|
||||||
} finally {
|
} finally {
|
||||||
$this->poll->done();
|
$this->poll->done();
|
||||||
}
|
}
|
||||||
|
@ -386,13 +386,20 @@ abstract class FilesystemDriverTest extends FilesystemTest
|
|||||||
$this->assertTrue($this->driver->exists($dir));
|
$this->assertTrue($this->driver->exists($dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateDirectoryRecursivelyExists(): void
|
public function testCreateDirectoryRecursivelyExistsDir(): void
|
||||||
{
|
{
|
||||||
$this->expectNotToPerformAssertions();
|
$this->expectNotToPerformAssertions();
|
||||||
|
|
||||||
$this->driver->createDirectoryRecursively(__DIR__, 0764);
|
$this->driver->createDirectoryRecursively(__DIR__, 0764);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCreateDirectoryRecursivelyExistsFile(): void
|
||||||
|
{
|
||||||
|
$this->expectException(FilesystemException::class);
|
||||||
|
|
||||||
|
$this->driver->createDirectoryRecursively(__FILE__, 0764);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateDirectoryFailsOnNonexistentPath(): void
|
public function testCreateDirectoryFailsOnNonexistentPath(): void
|
||||||
{
|
{
|
||||||
$fixtureDir = Fixture::path();
|
$fixtureDir = Fixture::path();
|
||||||
|
Loading…
Reference in New Issue
Block a user