fix: uppercase windows path letters after normalize

closes #618
This commit is contained in:
calebboyd
2019-05-28 18:02:32 -05:00
parent a0c8d31f03
commit e62d728624
3 changed files with 34 additions and 22 deletions
+9 -5
View File
@@ -35,6 +35,13 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
log = (text: string) => process.stderr.write('[nexe] - ' + text + '\n')
}
const winPath = (key: string) => {
if (isWin && key.substr(1, 2) === ':\\') {
key = key[0].toUpperCase() + key.substr(1)
}
return key
}
const getKey = function getKey(filepath: string | Buffer | null): string {
if (Buffer.isBuffer(filepath)) {
filepath = filepath.toString()
@@ -44,10 +51,7 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
}
let key = path.resolve(baseDir, filepath)
if (isWin && key.substr(1, 2) === ':\\') {
key = key[0].toUpperCase() + key.substr(1)
}
return key
return winPath(key)
}
const statTime = function() {
@@ -102,7 +106,7 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
const entry = manifest[filepath]
const absolutePath = getKey(filepath)
const longPath = makeLong(absolutePath)
const normalizedPath = path.normalize(filepath)
const normalizedPath = winPath(path.normalize(filepath))
if (!manifest[absolutePath]) {
manifest[absolutePath] = entry