[Fixing unit tests in Windows]

on windows open resources will be locked while the stream is open.
closing the resource allows deletion below
This commit is contained in:
Thomas Mueller 2013-06-10 19:28:55 +02:00
parent c0b25a4375
commit 74a170f2a5
1 changed files with 6 additions and 0 deletions

View File

@ -386,6 +386,12 @@ class View {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
list($count, $result) = \OC_Helper::streamCopy($source, $target);
// close open handle - especially $source is necessary because unlink below will
// throw an exception on windows because the file is locked
fclose($source);
fclose($target);
if ($result !== false) {
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
$storage1->unlink($internalPath1);