Use a custom basename functions instead of the shimed version because it doesn't work on Windows
493481
function basename (filename, ext) {
  return path.basename(
    filename.replace(/^[a-zA-Z]:/, '').replace(/\\/g, '/'),
    ext
  )
}
322098
def _file_name(fname, base_dir):
        

        fname = fname.replace("\\", "\\\\")

        if base_dir != '' and fname[0] != ':' and not os.path.isabs(fname):
            fname = os.path.join(base_dir, fname)

        return fname
1102705
def timestamp_filename(basename, ext=None):
    
    dt = datetime.now().strftime('%Y%m%d-%H%M%S-%f')
    if ext:
        return '%s-%s.%s' % (basename, dt, ext)
    return '%s-%s' % (basename, dt)
614608
def basename(path):
    """"""
    base_path = path.strip(SEP)
    sep_ind = base_path.rfind(SEP)
    if sep_ind < 0:
        return path

    return base_path[sep_ind + 1:]
341264
def make_tmpname(basename, n)
      extension = File.extname(basename)
      sprintf("%s,%d,%d%s", File.basename(basename, extension), $$, n.to_i, extension)
    end
281545
def pathify(basenames, examples_dir="examples/"):  # pragma: no cover
    """"""
    example = examples_dir.replace("/", ".")
    return [example + basename for basename in basenames]
532312
def replace_ext(filename, new_ext):
    """"""
    filename_base = os.path.splitext(filename)[0]
    new_filename = '{}.{}'.format(filename_base, new_ext)
    return new_filename
189246
function (base, path, noStartingSlash) {

        if (base === path) {
            return '';
        }

        // Sanitize inputs, convert windows to posix style slashes, ensure trailing slash for base
        base = base.replace(/^[a-z]:/i, '').replace(/\\/g, '/').replace(/\/$/g, '') + '/';
        path = path.replace(/^[a-z]:/i, '').replace(/\\/g, '/');
        // console.log(' ==== '+path);
        // Only truncate paths that overap with the base
        if (base === path.substr(0, base.length)) {
            path = '/' + path.substr(base.length);
        }

        var modifyStartingSlash = noStartingSlash !== undefined;

        if(modifyStartingSlash) {
            if (path[0] === '/' && noStartingSlash) {
                path = path.substr(1);
            } else if (path[0] !== '/' && !noStartingSlash){
                path = '/' + path;
            }
        }

        return path;

    }
153323
function Alias () {

  var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'],
      aliasFile = path.resolve(home + '/.pa/aliases.json');

  var writeAliases = function (aliases) {
    fs.writeFileSync(aliasFile, JSON.stringify(aliases, null, 2));
  };

  this.init = function () {
    if (!fs.existsSync(aliasFile)) {
      this.install();
    }
    this.aliases = require(aliasFile);
    return this;
  };

  this.install = function () {
    if (!fs.existsSync(path.resolve(home + '/.pa/'))) {
      fs.mkdirSync(path.resolve(home + '/.pa/'));
    }
    writeAliases(defaultAliases);
  };

  this.list = function () {
    var tmp, list = '';
    for (tmp in this.aliases) {
      list += '\n' + tmp + '=' + this.aliases[tmp];
    }
    return list.substr(1).green;
  };

  this.get = function (key) {
    var tmp;
    for (tmp in this.aliases) {
      if (this.aliases[tmp] === key) {
        return tmp.green;
      }
    }
    return ("no alias for '" + key + "'").red;
  };

  this.set = function (key, value) {
    this.aliases[key] = value;
    writeAliases(this.aliases);
    return ("set alias '" + key + "' for '" + value + "'").green;
  };

  this.trigger = function (argv) {
    if (typeof argv.alias !== 'string') {
      return this.list();
    }
    return argv._[0] ? this.set(argv._[0], argv.alias) : this.get(argv.alias);
  };

}
654963
def cleanupFilename(self, name):
        """"""

        context = self.context
        id = ''
        name = name.replace('\\', '/')  # Fixup Windows filenames
        name = name.split('/')[-1]  # Throw away any path part.
        for c in name:
            if c.isalnum() or c in '._':
                id += c

        # Raise condition here, but not a lot we can do about that
        if context.check_id(id) is None and getattr(context, id, None) is None:
            return id

        # Now make the id unique
        count = 1
        while 1:
            if count == 1:
                sc = ''
            else:
                sc = str(count)
            newid = "copy{0:s}_of_{1:s}".format(sc, id)
            if context.check_id(newid) is None \
                    and getattr(context, newid, None) is None:
                return newid
            count += 1
1320340
def string_to_basename(s):
    '''
    
    '''
    s = s.strip().lower()
    s = re.sub(r'[^\w\s-]', '', s)
    return re.sub(r'[\s-]+', '-', s)
319043
function getUniqueFilename(base, filename) {
    if (!filename) {
        filename = base;
        base = '/';
    }

    filename = path.resolve(base, filename);
    var ext = path.extname(filename);
    filename = path.join(path.dirname(filename), path.basename(filename, ext));

    var _filename = filename+ext;

    var i = 0;
    while (fs.existsSync(filename)) {
        _filename = filename+'_'+i+ext;
        i = i + 1;
    }

    return path.relative(base, _filename);
}
1241274
function createBasenameList(files) {
    const basenames = {};
    files.forEach(function (file) {
        const basename = file.replace(/(-[0-9]+.[0-9]+.[A-Za-z0-9_-]+)?([.-]min)?(.amd|.commonjs|.mustache)?(\.[a-zA-Z]+$)/, '');
        basenames[basename] = true;
    });
    return Object.keys(basenames);
}
129139
def rename(self, src_basename, dest_basename, datadir="outdir"):
        
        directory = {
            "indir": self.indir,
            "outdir": self.outdir,
            "tmpdir": self.tmpdir,
        }[datadir]

        src = directory.path_in(src_basename)
        dest = directory.path_in(dest_basename)

        os.rename(src, dest)
667237
static function changeBasename( &$mimeInfo, $basename )
    {
        $mimeInfo['basename'] = $basename;
        $mimeInfo['filename'] = $basename . '.' . $mimeInfo['suffix'];
        if ( $mimeInfo['dirpath'] )
            $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
        else
            $mimeInfo['url'] = $mimeInfo['filename'];
    }
937563
def _sanitize_windows_name(cls, arcname, pathsep):
        """"""
        table = cls._windows_illegal_name_trans_table
        if not table:
            illegal = ':<>|"?*'
            table = str.maketrans(illegal, '_' * len(illegal))
            cls._windows_illegal_name_trans_table = table
        arcname = arcname.translate(table)
        # remove trailing dots
        arcname = (x.rstrip('.') for x in arcname.split(pathsep))
        # rejoin, removing empty parts.
        arcname = pathsep.join(x for x in arcname if x)
        return arcname
1215581
def rename(src, dst):
    '''
    
    '''
    src = os.path.expanduser(src)
    dst = os.path.expanduser(dst)

    if not os.path.isabs(src):
        raise SaltInvocationError('File path must be absolute.')

    try:
        os.rename(src, dst)
        return True
    except OSError:
        raise CommandExecutionError(
            'Could not rename \'{0}\' to \'{1}\''.format(src, dst)
        )
    return False