Example #1
0
 /**
  * Returns a path without leading / or C:\. If this is not
  * present the path is returned as is.
  * 
  * @static
  * @access  public 
  * @param   string  $path The path to be processed
  * @return  string  The processed path or the path as is
  */
 function skipRoot($path)
 {
     if (File::isAbsolute($path)) {
         if (OS_WINDOWS) {
             return substr($path, $path[3] == '\\' ? 4 : 3);
         }
         return ltrim($path, '/');
     }
     return $path;
 }
Example #2
0
 function testisAbsolute()
 {
     $this->assertFalse(File::isAbsolute('abra/../cadabra'));
     $this->assertFalse(File::isAbsolute('data/dir'));
     if (OS_WINDOWS) {
         $this->assertTrue(File::isAbsolute('C:\\\\data'));
         $this->assertTrue(File::isAbsolute('d:/data'));
         $this->assertFalse(File::isAbsolute('\\'));
     } else {
         $this->assertTrue(File::isAbsolute('/'));
         $this->assertFalse(File::isAbsolute('\\'));
         $this->assertTrue(File::isAbsolute('~mike/bin'));
     }
 }
Example #3
0
 /**
  * Returns a path without leading / or C:\. If this is not
  * present the path is returned as is.
  *
  * @access public
  * @param  string $path The path to be processed
  * @return string       The processed path or the path as is
  */
 function skipRoot($path)
 {
     if (File::isAbsolute($path)) {
         if (DIRECTORY_SEPARATOR == "/") {
             return substr($path, 1);
         } elseif (DIRECTORY_SEPARATOR == "\\") {
             return substr($path, 3);
         }
     } else {
         return $path;
     }
 }