public function testGetCanonicalURL()
 {
     if (AdvancedPathLib::getCurrentOS() == AdvancedPathLib::OS_WINDOWS) {
         $currentDriveLetter = utf8_strtoupper(utf8_substr(realpath('.'), 0, 2));
         $this->assertEquals('file://' . $currentDriveLetter . '/mypath/to/a/file', AdvancedPathLib::getCanonicalURL('/mypath/to/a/file'));
         $this->assertEquals('file://' . $currentDriveLetter . '/to/a/dir', AdvancedPathLib::getCanonicalURL('/mypath/../to/a/dir/'));
     } else {
         $this->assertEquals('file:///mypath/to/a/file', AdvancedPathLib::getCanonicalURL('/mypath/to/a/file'));
         $this->assertEquals('file:///to/a/dir', AdvancedPathLib::getCanonicalURL('/mypath/../to/a/dir/', AdvancedPathLib::OS_UNIX));
     }
     $this->assertEquals('ftp://*****:*****@eyeos.org/a/file', AdvancedPathLib::getCanonicalURL('ftp://*****:*****@eyeos.org/mypath/..//to//../a/file'));
     $this->assertEquals('file://' . strtr(realpath(EYEOS_TESTS_TMP_PATH), '\\', '/') . '/my/path', AdvancedPathLib::getCanonicalURL('./tests/tmp/my/path'));
 }
 /**
  * @param string $path
  * @param SimpleXMLElement $xmlConf
  * @return AbstractFile
  */
 public static function getRealFile($path, $xmlParams = null, $params = null)
 {
     $moutpointDescriptors = MountpointsManager::getInstance()->getMountpointDescriptorsList($path);
     $mountedPath = null;
     $realPath = AdvancedPathLib::getCanonicalURL($path);
     foreach ($moutpointDescriptors as $moutpointDescriptor) {
         $mountpointPath = $moutpointDescriptor->getMountpointPath();
         if (utf8_strpos($realPath, $mountpointPath) === 0) {
             $mountedPath = $moutpointDescriptor->getTargetPath();
             $mountedPath .= '/' . utf8_substr($realPath, utf8_strlen($mountpointPath));
         }
     }
     if ($mountedPath !== null) {
         return FSI::getFile($mountedPath, $params);
     }
     return null;
 }
Example #3
0
 /**
  * @return string
  */
 public function getAbsolutePath()
 {
     return AdvancedPathLib::getCanonicalURL($this->getURLComponents(), AdvancedPathLib::OS_UNIX);
 }
Example #4
0
 public function setMountpointPath($mountpointPath)
 {
     $this->mountpointPath = AdvancedPathLib::getCanonicalURL($mountpointPath);
 }