Returns the destination for the SVG to be rendered at, explicity defined
using `vFile.data.destinationDir`, or falling back to the file's current
directory.

@param {vFile} vFile
@return {string}
514433
function getDestinationDir(vFile) {
  if (vFile.data.destinationDir) {
    return vFile.data.destinationDir;
  }

  return vFile.dirname;
}
409912
function(src, dest, transform) {
        if (typeof src !== 'string' || src.length === 0) {
            throw 'Invalid source file path (arg #1)';
        }
        if (typeof dest !== 'string' || dest.length === 0) {
            throw 'Invalid destination file path (arg #2)';
        }
        if (typeof transform !== 'function') {
            transform = function(data) {
                return data;
            };
        }

        var def = _promise.deferred();
        _fs.readFile(src, function(err, data) {
            if (err) {
                def.reject(err);
            } else {
                var data = transform(data.toString());
                _fs.writeFile(dest, data, function(err, data) {
                    if (err) {
                        def.reject(err);
                    } else {
                        def.resolve();
                    }
                });
            }
        });

        return def.promise();
    }
990449
function outputPath(options, source) {
    var DEBUG = false;
    if (DEBUG)
        console.log('sourceFolder: ' + options.sourceFolder);
    var globBase = options.sourceFolder.replace(/\*.*/, '');
    if (globBase.endsWith('.sol')) // single file
        globBase = path.join(globBase, '../');
    if (DEBUG)
        console.log('globBase: ' + globBase);
    var optDestination = options.destinationFolder ? options.destinationFolder : globBase;
    if (DEBUG)
        console.log('optDestination: ' + optDestination);
    var destinationFolder = path.join(globBase, optDestination);
    if (optDestination === globBase)
        destinationFolder = globBase;
    if (DEBUG)
        console.log('destinationFolder: ' + destinationFolder);
    // destination-folder is absolut
    if (options.destinationFolder && options.destinationFolder.startsWith('/'))
        destinationFolder = path.join(options.destinationFolder, './');
    var fileNameRelative = source.filename.replace(globBase, '');
    if (DEBUG)
        console.log('fileNameRelative: ' + fileNameRelative);
    var goalPath = path.join(destinationFolder, fileNameRelative);
    return goalPath;
}
210113
function getSvgDefsElement() {
  // return if found
  const defsElement = document.getElementById('precision-inputs-svg-defs');
  if (defsElement) { return defsElement; }

  // otherwise create it
  const svg = document.createElementNS(svgNS, 'svg');
  svg.style.position = 'absolute';
  svg.style.left = 0;
  svg.style.top = 0;
  svg.style.width = 0;
  svg.style.height = 0;
  svg.style.opacity = 0;
  const defs = document.createElementNS(svgNS, 'defs');
  defs.id = 'precision-inputs-svg-defs';
  svg.appendChild(defs);
  document.body.appendChild(svg);

  return defs;
}
309526
def _get_destination(script_parts):
    """"""
    for part in script_parts:
        if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
            return part
282342
function getFilepathFromUrl (u) {
	const nu = normalizeUrl(u, {removeTrailingSlash: true});
	return getPathnameFromUrl(nu).substring(1);
}
740695
function getPathToDestination(pathToSource, pathToDestinationFile) {
		var isDestinationDirectory = (/\/$/).test(pathToDestinationFile);
		var fileName = path.basename(pathToSource);
		var newPathToDestination;
		if (typeof pathToDestinationFile === 'undefined') {
			newPathToDestination = pathToSource;
		} else {
			newPathToDestination = pathToDestinationFile + (isDestinationDirectory ? fileName : '');
		}
		return newPathToDestination;
	}
72323
function(destPath) {
    this.checkDestDir(destPath);
    var exists = existsSync(destPath);
    // we warn if
    // if (exists) {
    //   this.ui.writeLine('The destination path: ' + destPath + ' already exists. Cannot overrwrite.', 'WARNING');
    // }

    return {
      destExists: exists,
      destDir: this.createDestDir
    };
  }
957502
function(next) {
          // Here destination is allways a file.
          // Only the parent folder is required
          var dir = dirname(dest);
          if(dirExists[dir]) {
            return next();
          }

          grunt.verbose.writeln('  Make directory %s', dir.blue);
          mkdirp(dir, function(err) {
            if(err) {
              return next(err);
            }
            tally.dirs++;
            dirExists[dir] = true;
            return next();
          });

        }
1165847
function inlineAssets(rootFolder, currentFile) {
    return function($) {
        return Promise()

        // Resolving images and fetching external images should be
        // done before svg conversion
        .then(resolveImages.bind(null, currentFile, $))
        .then(fetchRemoteImages.bind(null, rootFolder, currentFile, $))

        .then(svgToImg.bind(null, rootFolder, currentFile, $))
        .then(svgToPng.bind(null, rootFolder, currentFile, $))
        .then(inlinePng.bind(null, rootFolder, currentFile, $));
    };
}
561206
function locateNode (vnode) {
  return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
    ? locateNode(vnode.componentInstance._vnode)
    : vnode
}
197462
@TargetApi(Build.VERSION_CODES.KITKAT)
   private Path objectToPath(SvgElement obj, boolean allowUse)
   {
      // Save style state
      stateStack.push(state);
      state = new RendererState(state);

      updateStyleForElement(state, obj);

      if (!display() || !visible()) {
         state = stateStack.pop();
         return null;
      }

      Path  path = null;

      if (obj instanceof SVG.Use)
      {
         if (!allowUse) {
            error("<use> elements inside a <clipPath> cannot reference another <use>");
         }

         // Locate the referenced object
         SVG.Use  useElement = (SVG.Use) obj;
         SVG.SvgObject  ref = obj.document.resolveIRI(useElement.href);
         if (ref == null) {
            error("Use reference '%s' not found", useElement.href);
            state = stateStack.pop();
            return null;
         }
         if (!(ref instanceof SvgElement)) {
            state = stateStack.pop();
            return null;
         }

         path = objectToPath((SvgElement) ref, false);
         if (path == null)
            return null;

         if (useElement.boundingBox == null) {
            useElement.boundingBox = calculatePathBounds(path);
         }

         if (useElement.transform != null)
            path.transform(useElement.transform);
      }
      else if (obj instanceof SVG.GraphicsElement)
      {
         SVG.GraphicsElement  elem = (SVG.GraphicsElement) obj;

         if (obj instanceof SVG.Path)
         {
            SVG.Path  pathElem = (SVG.Path) obj;
            path = (new PathConverter(pathElem.d)).getPath();
            if (obj.boundingBox == null)
               obj.boundingBox = calculatePathBounds(path);
         }
         else if (obj instanceof SVG.Rect)
            path = makePathAndBoundingBox((SVG.Rect) obj);
         else if (obj instanceof SVG.Circle)
            path = makePathAndBoundingBox((SVG.Circle) obj);
         else if (obj instanceof SVG.Ellipse)
            path = makePathAndBoundingBox((SVG.Ellipse) obj);
         else if (obj instanceof SVG.PolyLine)
            path = makePathAndBoundingBox((SVG.PolyLine) obj);

         if (path == null)
            return null;

         if (elem.boundingBox == null) {
            elem.boundingBox = calculatePathBounds(path);
         }

         if (elem.transform != null)
            path.transform(elem.transform);

         path.setFillType(getClipRuleFromState());
      }
      else if (obj instanceof SVG.Text)
      {
         SVG.Text  textElem = (SVG.Text) obj;
         path = makePathAndBoundingBox(textElem);

         if (path == null)
            return null;

         if (textElem.transform != null)
            path.transform(textElem.transform);

         path.setFillType(getClipRuleFromState());
      }
      else {
         error("Invalid %s element found in clipPath definition", obj.getNodeName());
         return null;
      }

      // Does the clippath child element also have a clippath?
      if (state.style.clipPath != null)
      {
         Path  childsClipPath = calculateClipPath(obj, obj.boundingBox);
         if (childsClipPath != null)
            path.op(childsClipPath, Path.Op.INTERSECT);
      }

      // Restore style state
      state = stateStack.pop();

      return path;
   }
94627
function createIconFiles(srcFile, dest) {
  const thisTaskName = swlog.logSubStart('create icon files');

  return new Promise(resolve => {
    const exportArtboardsOptions = [
      'export',
      'artboards',
      srcFile,
      `--formats=${options.iconFormats.join(',')}`,
      '--include-symbols=NO',
      '--save-for-web=YES',
      `--output=${dest}`
    ];

    const outputStr = sketchtoolExec(exportArtboardsOptions.join(' '));
    resolve(outputStr);
  })
  .then(output => {
    options.iconFormats.forEach(format => {
      const regex = new RegExp(`\\.${format}`, 'g');
      const count = (output.match(regex) || []).length;
      swlog.logTaskAction('Created', `${count} ${format.toUpperCase()} files`);
    })

    swlog.logSubEnd(thisTaskName);

    if (options.iconFormats.indexOf('svg') !== -1) {
      return optimizeSVGs(dest);
    }
  });
}
900858
function getComponentPath (componentName) {
  let entry = COMPONENTS.find(({ name }) => name === componentName)
  if (!entry) {
    return null
  }
  return `veui/${COMPONENTS_DIRNAME}/${entry.path}`
}
220668
function globFile (file) {
    return stat(file).then(({ err, stats }) => {
      if (err) throw err
      if (stats.isDirectory()) {
        // TODO what if file is already slash-terminated?
        switch (file) {
          case './':
            return globPromise('./*.js')
          case 'bin':
            return globPromise('bin/*')
          default:
            return globPromise(`${file}/**/*.js`)
        }
      } else {
        return Promise.resolve(file)
      }
    })
  }
707274
function optimizeSVGs(src) {
  const startOptimizeTaskName = swlog.logSubStart('optimize SVGs');

  // Optimize with svgo:
  const svgoOptimize = new svgo({
    js2svg: { useShortTags: false },
    plugins: [
      { removeViewBox: false },
      { convertColors: { currentColor: '#000000' }},
      { removeDimensions: true },
      { moveGroupAttrsToElems: true },
      { removeUselessStrokeAndFill: true },
      { customSvgoRemoveGroupFill },
      { customSvgoNonScalingStroke },
      { customSvgoFillStroke }
    ]
  });

  const svgFiles = glob.sync(`${src}/*.svg`);

  // Divide each optimization into a promise
  const svgPromises = svgFiles.map(async filepath => {
    try {
      const data = await readFile(filepath, 'utf8');
      const dataOptimized = await svgoOptimize.optimize(data);

      await writeFile(filepath, dataOptimized.data, 'utf-8');
    } catch(err) {
      swlog.error(err);
    }
  });

  return Promise.all(svgPromises).then(() => {
    swlog.logSubEnd(startOptimizeTaskName);
  }).catch(swlog.error);
}
1041887
def destination(self):
        
        return os.path.join(os.path.abspath(self.outdir), self.filename)