You are here

function sassy_compass__resolve_path in Sassy 7.3

Same name and namespace in other branches
  1. 7.2 extensions/compass/sassy_compass.module \sassy_compass__resolve_path()
4 calls to sassy_compass__resolve_path()
sassy_compass__image_info in sassy_compass/functions/image_size.inc
sassy_compass__inline_font_files in sassy_compass/functions/inline_image.inc
sassy_compass__inline_image in sassy_compass/functions/inline_image.inc
sassy_compass__url in sassy_compass/functions/urls.inc

File

sassy_compass/sassy_compass.module, line 91

Code

function sassy_compass__resolve_path($file) {
  if ($file[0] == '/') {
    return $file;
  }
  if (!($path = realpath($file))) {
    $path = SassScriptFunction::$context->node->token->filename;
    $path = substr($path, 0, strrpos($path, '/')) . '/';
    $path = $path . $file;
    print $path;
    $last = '';
    while ($path != $last) {
      $last = $path;
      $path = preg_replace('`(^|/)(?!\\.\\./)([^/]+)/\\.\\./`', '$1', $path);
    }
    $path = realpath($path);
  }
  print "{$path}<br/>";
  if ($path) {
    return $path;
  }
  return false;
}