Receive plugin folder path from current Sketch installation
@return {string}
764764
function pluginFolder () {
  const path = sketchtoolExec('show plugins');
  invariant(path, 'Plugin folder not found!');
  invariant(fs.existsSync(path), `Plugin folder does not exist at ${path}!`);
  return path;
}
203294
function() {
    if (!this._inRepoAddons) {
      const pkg = this.project.pkg;
      const inRepoAddonPaths = pkg['ember-addon'] && pkg['ember-addon'].paths;
      this._inRepoAddons = (inRepoAddonPaths || []).map((addonPath) => {
        let addonName = path.basename(addonPath);
        return this.project.findAddonByName(addonName);
      });
    }

    return this._inRepoAddons.filter(Boolean);
  }
419720
function runPluginWithIdentifier (pluginName, identifier, options = {}) {
  const pluginFolderPath = options.dir || pluginFolder();

  // Append `.sketchplugin` if not passed in with the plugin name
  if (!pluginName.endsWith('.sketchplugin')) {
    pluginName += '.sketchplugin';
  }
  const pluginPath = `${pluginFolderPath}/${pluginName}`;

  // Check if the plugin actually exists before running anything!
  const exists = fs.existsSync(pluginPath);
  invariant(
    exists,
    `Plugin '${pluginPath}' not found! Cannot run plugin command!`
  );

  let args = '';

  if (options.context) {
    args += `--context='${JSON.stringify(options.context)}' `;
  }

  sketchtoolExec(`run ${escape(pluginPath)} ${identifier} ${args}`);
}
145752
function paths(dir) {
	var paths = [];

	try {
		fs.statSync(dir);
	}
	catch (e) {
		return e;
	}

	(function traverse(dir, stack) {
		stack.push(dir);
		fs.readdirSync(stack.join('/')).forEach(function(file) {
			var path = stack.concat([file]).join('/'),
				stat = fs.statSync(path);

			if (file[0] == '.' || file === 'vendor') {
				return;
			} else if (stat.isFile() && /\.js$/.test(file)) {
				paths.push(path);
			} else if (stat.isDirectory()) {
				paths.push(path);
				traverse(file, stack);
			}
		});
		stack.pop();
	})(dir || '.', []);

	return paths;
}
1203619
function find_application_dir(applications_dir) {

  const files_in_applications_dir = fs.readdirSync(applications_dir);

  for (let i = 0; i < files_in_applications_dir.length; i++) {
    const file = files_in_applications_dir[i];
    if (!file.includes('Adobe After Effects'))
      continue;

    const app_dir = path.join(applications_dir, file);

    //If some wise-ass named a folder 'Adobe After Effects Plugins' or whatever and leaves
    //it in his applications directory, we don't want to choose it. We want to choose an application_dir
    //that's going to have an After Effects.app in it.
    if (find_application(app_dir) !== null)
      return app_dir;
  }

  return null;
}
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
890337
function getorigPath(filePath, base) {
    var extName = path.extname(filePath);
    var pt = path.resolve(base, filePath);
    if (!extName) pt += '.js';
    return pt;
}
1093478
function getScriptPath()
    {
        $fileName = $this->stack->pop();
        if ($this->baseDir) {
            return $this->baseDir . \DIRECTORY_SEPARATOR . $fileName;
        } else {
            return (string)$fileName;
        }
    }
919683
function dirInstall(dirpath, callback) {
  callback = utils.defineCallback(callback);
  return fs.exists(dirpath, function(exists) {
    if (!exists) {
      return callback(new errors.DirectoryNotExistingError());
    }
    var pluginName = path.basename(dirpath);
    var destPath = path.join(pluginsDir, pluginName);
    return ncp(dirpath, destPath, function(copyError) {
      if (copyError) {
        return callback(new errors.PluginsMoveFromTempError(copyError));
      }
      return callback(null);
    });
  });
}
283269
function getResolvedPath(options, type = 'html') {
  const explicitPathKey = `${ type }Path`

  if (options[explicitPathKey]) {
    return path.resolve(options[explicitPathKey])
  }

  return path.resolve(options.outputDir, `${ options.fontName }.${ type }`)
}
870552
public static String getFindBugsEnginePluginLocation() {
        // findbugs.home should be set to the directory the plugin is
        // installed in.
        URL u = plugin.getBundle().getEntry("/");
        try {
            URL bundleRoot = FileLocator.resolve(u);
            String path = bundleRoot.getPath();
            if (FindBugsBuilder.DEBUG) {
                System.out.println("Pluginpath: " + path); //$NON-NLS-1$
            }
            if (path.endsWith("/eclipsePlugin/")) {
                File f = new File(path);
                f = f.getParentFile();
                f = new File(f, "findbugs");
                path = f.getPath() + "/";
            }

            return path;
        } catch (IOException e) {
            FindbugsPlugin.getDefault().logException(e, "IO Exception locating engine plugin");
        }
        return null;
    }
1172751
function getAppDir() {
    var fileRepo = args._[1] ? path.resolve(args._[1]) : undefined;
    return fileRepo && fs.existsSync(fileRepo) ? fileRepo : 0;
}
1175266
function () {
            var result = this.props.parentPath + this.props.name;

            // Add trailing slash for directories
            if (!FileTreeViewModel.isFile(this.props.entry) && _.last(result) !== "/") {
                result += "/";
            }

            return result;
        }
348894
function getCoverPath(output) {
    var outputRoot = output.getRoot();
    var book = output.getBook();
    var config = book.getConfig();
    var coverName = config.getValue('cover', 'cover.jpg');

    // Resolve to absolute
    var cover = fs.pickFile(outputRoot, coverName);
    if (cover) {
        return cover;
    }

    // Multilingual? try parent folder
    if (book.isLanguageBook()) {
        cover = fs.pickFile(path.join(outputRoot, '..'), coverName);
    }

    return cover;
}
949360
function getPaths (settings) {
  return settings.paths.controllers
    .filter(obj => obj.enabled)
    .map(obj => obj.path)
    .concat(settings.paths.assets)
    .concat(settings.paths.views)
    .concat(settings.livereload.paths)
    .sort()
}
900858
function getComponentPath (componentName) {
  let entry = COMPONENTS.find(({ name }) => name === componentName)
  if (!entry) {
    return null
  }
  return `veui/${COMPONENTS_DIRNAME}/${entry.path}`
}
1187783
function(dir, prefix) {
    if (fs.existsSync(dir)) {
      let dirname = path.relative(this.project.root, dir);
      let globs = this.parentRegistry.extensionsForType('js').map((extension) => `**/*.${extension}`);

      return walkSync(dir, { directories: false, globs }).map(file => {
        let module = prefix + '/' + file.replace(EXT_RE, '.js');
        this.fileLookup[module] = path.join(dirname, file);
        return module;
      });
    } else {
      return [];
    }
  }