<?php
namespace TYPO3\CMS\Core\Resource\Driver;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
/***************************************************************
* Copyright notice
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
+
/**
* Driver for the local file system
*
}
$directoryEntries = array();
while ($iterator->valid()) {
- /** @var $entry SplFileInfo */
+ /** @var $entry \SplFileInfo */
$entry = $iterator->current();
// skip non-files/non-folders, and empty entries
if (!$entry->isFile() && !$entry->isDir() || $entry->getFilename() == '') {
$iterator->next();
continue;
}
- $entryPath = substr($entry->getPathname(), strlen($path));
+ $entryPath = GeneralUtility::fixWindowsFilePath(substr($entry->getPathname(), strlen($path)));
if ($entry->isDir()) {
$entryPath .= '/';
}
public function renameFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $newName) {
// Makes sure the Path given as parameter is valid
$newName = $this->sanitizeFileName($newName);
- $newIdentifier = rtrim(dirname($file->getIdentifier()), '/') . '/' . $newName;
+ $newIdentifier = rtrim(GeneralUtility::fixWindowsFilePath(dirname($file->getIdentifier())), '/') . '/' . $newName;
// The target should not exist already
if ($this->fileExists($newIdentifier)) {
throw new \TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException('The target file already exists.', 1320291063);
$newName = $this->sanitizeFileName($newName);
$relativeSourcePath = $folder->getIdentifier();
$sourcePath = $this->getAbsolutePath($relativeSourcePath);
- $relativeTargetPath = rtrim(dirname($relativeSourcePath), '/') . '/' . $newName . '/';
+ $relativeTargetPath = rtrim(GeneralUtility::fixWindowsFilePath(dirname($relativeSourcePath)), '/') . '/' . $newName . '/';
$targetPath = $this->getAbsolutePath($relativeTargetPath);
// get all files and folders we are going to move, to have a map for updating later.
$filesAndFolders = $this->getFileAndFoldernamesInPath($sourcePath, TRUE);
<?php
namespace TYPO3\CMS\Core\Tests\Unit\Resource\Driver;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
/***************************************************************
* Copyright notice
'basePath' => $this->getMountRootUrl()
));
$mockedFile = $this->getSimpleFileMock('/someDir/someFile');
- $filePath = $fixture->copyFileToTemporaryPath($mockedFile);
+ $filePath = GeneralUtility::fixWindowsFilePath($fixture->copyFileToTemporaryPath($mockedFile));
$this->assertContains('/typo3temp/', $filePath);
$this->assertEquals($fileContents, file_get_contents($filePath));
}
public function permissionsAreCorrectlyRetrievedForForbiddenFile() {
if (function_exists('posix_getegid') && posix_getegid() === 0) {
$this->markTestSkipped('Test skipped if run on linux as root');
+ } elseif (TYPO3_OS === 'WIN') {
+ $this->markTestSkipped('Test skipped if run on Windows system');
}
/** @var $fixture \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
list($basedir, $fixture) = $this->prepareRealTestEnvironment();
public function permissionsAreCorrectlyRetrievedForForbiddenFolder() {
if (function_exists('posix_getegid') && posix_getegid() === 0) {
$this->markTestSkipped('Test skipped if run on linux as root');
+ } elseif (TYPO3_OS === 'WIN') {
+ $this->markTestSkipped('Test skipped if run on Windows system');
}
/** @var $fixture \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
list($basedir, $fixture) = $this->prepareRealTestEnvironment();
* @dataProvider getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser_dataProvider
*/
public function getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser($group, $permissions, $expectedResult) {
+ if (TYPO3_OS === 'WIN') {
+ $this->markTestSkipped('Test skipped if run on Windows system');
+ }
$this->addToMount(array(
'testfile' => 'asdfg'
));