How to use the path.sep function in path

To help you get started, we’ve selected a few path examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MustD / a3al / app / api / ModScanner.js View on Github external
if (-1 != ignore.indexOf(dirEntry))
        continue;
      var linkName = dirEntry;
      var realBaseName = dirEntry;
      var realLoc = scanPath + path.sep + dirEntry;
      var entryStat = fs.lstatSync(realLoc);
      if (entryStat.isSymbolicLink()) {
        realLoc = fs.realpathSync(realLoc);
        entryStat = fs.statSync(realLoc);
        realBaseName = realLoc.split(/[\\/]/).pop();
      }
      if (entryStat.isDirectory()) {
        var modEntry = fromJS([]).asMutable();
        var isMod = false;
        // check if it's a mod
        var modName = this.parseFileForName(realLoc + path.sep + "mod.cpp");
        var metaName = this.parseFileForName(realLoc + path.sep + "meta.cpp");
        if (!modName && !metaName) {
          // last try: check for addons directory
          if (this.checkDirAccessible(realLoc + path.sep + "addons") || this.checkDirAccessible(realLoc + path.sep + "Addons")) {
            isMod = true;
            modName = metaName = ""; //dirEntry;
            if (this.isAllNumbers(dirEntry) && !this.isAllNumbers(realBaseName)) {
              linkName = realBaseName;
            }
          } else {
            console.log("Failed entry: " + dirEntry + ": no .cpp files, no addons directory");
          }
        } else {
          isMod = true;
          if (!!modName && !!metaName) {
            if (modName.length < metaName.length) {
github jlengstorf / lengstorf.com / src / components / SEO / SEO.js View on Github external
render={({ site: { siteMetadata: seo } }) => {
      const postMeta =
        frontmatter || postData.childMarkdownRemark.frontmatter || {};

      const title = postMeta.title || seo.title;
      const description = postMeta.description || seo.description;
      const image = postImage ? `${seo.canonicalUrl}${postImage}` : seo.image;
      const url = postMeta.slug
        ? `${seo.canonicalUrl}${path.sep}${postMeta.slug}`
        : seo.canonicalUrl;
      const datePublished = isBlogPost ? postMeta.datePublished : false;

      return (
        
          
            {/* General tags */}
            <title>{title}</title>
            
            

            {/* OpenGraph tags */}
            
            {isBlogPost ?  : null}
github lbryio / lbry-desktop / ui / redux / actions / app.js View on Github external
return (dispatch, getState) => {
    // @if TARGET='app'
    const state = getState();
    // Make a new directory within temp directory so the filename is guaranteed to be available
    const dir = Fs.mkdtempSync(remote.app.getPath('temp') + path.sep);
    const upgradeFilename = selectUpgradeFilename(state);

    const options = {
      onProgress: p => dispatch(doUpdateDownloadProgress(Math.round(p * 100))),
      directory: dir,
    };
    download(remote.getCurrentWindow(), selectUpdateUrl(state), options).then(downloadItem => {
      /**
       * TODO: get the download path directly from the download object. It should just be
       * downloadItem.getSavePath(), but the copy on the main process is being garbage collected
       * too soon.
       */

      dispatch({
        type: ACTIONS.UPGRADE_DOWNLOAD_COMPLETED,
        data: {
github lloiser / go-debug / lib / utils.js View on Github external
export function shortenPath (file) {
  return path.normalize(file).split(path.sep).slice(-2).join(path.sep)
}
export function location (file, line) {
github nusmodifications / nusmods / api / __mocks__ / fs-extra.js View on Github external
fs.readdirSync = (directoryPath) => {
  const pathArr = directoryPath.split(path.sep);
  return Object.keys(R.path(pathArr, mockFiles)) || [];
};
github catamphetamine / webpack-isomorphic-tools / source / index.js View on Github external
paths.map(function(a_path)
			{
				var parts = a_path.split(path.sep)
				if (parts[parts.length - 1] === 'node_modules')
				{
					parts[parts.length - 1] = ''
					return parts.join(path.sep)
				}
			})
			.filter(function(a_path)
github TradeMe / tractor / packages / tractor-plugin-visual-regression / src / tractor / server / files / diff-png-file.spec.js View on Github external
it('should create a new PageObjectFile', () => {
            let fileStructure = new FileStructure(path.join(path.sep, 'file-structure'));
            let filePath = path.join(path.sep, 'file-structure', 'directory', 'file');

            let file = new DiffPNGFile(filePath, fileStructure);

            expect(file).to.be.an.instanceof(DiffPNGFile);
        });
github sysgears / apollo-universal-starter-kit / modules / core / server-ts / app.ts View on Github external
    app.get('/servdir', (req, res) => res.send(process.cwd() + path.sep));
  }
github yhat / rodeo / src / node / index.js View on Github external
function onGetSystemFacts() {
  return bluebird.props({
    homedir: os.homedir(),
    pathSep: path.sep,
    delimiter: path.delimiter
  }).timeout(systemFactTimeout * second, 'Unable to call "get system facts" in under ' + systemFactTimeout + ' seconds');
}
github thinkjs / thinkjs / src / controller / rest.js View on Github external
getResource(){
    let filename = this.__filename || __filename;
    let last = filename.lastIndexOf(path.sep);
    return filename.substr(last + 1, filename.length - last - 4);
  }
  /**