Skip to content
Open
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
12 changes: 11 additions & 1 deletion lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,18 @@ function findImport($url) {
}

function fileExists($name) {
if (file_exists($name)) {
return $name;
}

// sym link workaround
return file_exists($name) || file_exists(realpath(preg_replace('/\w+\/\.\.\//', '', $name)));
$pattern = '/([^.][^\/]*\/|\.[^.\/][^\/]*\/|\.\.[^\/]+\/)\.\.\//';
while (preg_match($pattern, $name, $matches)) {
$name = preg_replace($pattern, '/', $name);
}
if (file_exists(realpath($name))) {
return realpath($name);
}
}

static function compressList($items, $delim) {
Expand Down