Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function compileFile( $fname, $outFname = null ) {
$oldImport = $this->importDir;

$this->importDir = (array)$this->importDir;
$this->importDir[] = realpath( $pi['dirname'] ).'/';
$this->importDir[] = Less_Parser::AbsPath( $pi['dirname'] ).'/';

$this->allParsedFiles = array();
$this->addParsedFile( $fname );
Expand Down Expand Up @@ -271,6 +271,6 @@ public function allParsedFiles() {
}

protected function addParsedFile( $file ) {
$this->allParsedFiles[realpath( $file )] = filemtime( $file );
$this->allParsedFiles[Less_Parser::AbsPath( $file )] = filemtime( $file );
}
}
14 changes: 13 additions & 1 deletion lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public function parseFile( $filename, $uri_root = '', $returnRoot = false){


if( $filename ){
$filename = self::WinPath(realpath($filename));
$filename = self::AbsPath($filename, true);
}
$uri_root = self::WinPath($uri_root);

Expand Down Expand Up @@ -2660,6 +2660,18 @@ public static function WinPath($path){
return str_replace('\\', '/', $path);
}

public static function AbsPath($path, $winPath = false){
if (strpos($path, '//') !== false && preg_match('_^(https?:)?//\\w+(\\.\\w+)+/\\w+_', $path)) {
return $winPath ? '' : false;
} else {
$path = realpath($path);
if ($winPath) {
$path = self::WinPath($path);
}
return $path;
}
}

public function CacheEnabled(){
return (Less_Parser::$options['cache_method'] && (Less_Cache::$cache_dir || (Less_Parser::$options['cache_method'] == 'callback')));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Less/Tree/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function ParseImport( $full_path, $uri, $env ){
*/
private function Skip($path, $env){

$path = Less_Parser::winPath(realpath($path));
$path = Less_Parser::AbsPath($path, true);

if( $path && Less_Parser::FileParsed($path) ){

Expand Down