Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta committed Oct 4, 2024
1 parent f980295 commit 6bc33aa
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions packages/app-builder-lib/src/asar/asarUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ export class AsarPackager {
const realPathRelative = path.relative(this.config.appDir, realPathFile)
const symlinkDestination = path.resolve(this.rootForAppFilesWithoutAsar, realPathRelative)

const isOutsidePackage = realPathRelative.startsWith("../")
if (isOutsidePackage) {
log.debug(
{ source: source, realPathRelative: realPathRelative, realPathFile: realPathFile, destination: destination },
`file linked outstide. Skipping symlink, copying file directly`
)
const buffer = fs.readFileSync(source)
return this.copyFileOrData(buffer, source, destination, stat)
}
// const isOutsidePackage = realPathRelative.startsWith("../")
// if (isOutsidePackage) {
// log.debug(
// { source: source, realPathRelative: realPathRelative, realPathFile: realPathFile, destination: destination },
// `file linked outstide. Skipping symlink, copying file directly`
// )
// const buffer = fs.readFileSync(source)
// return this.copyFileOrData(buffer, source, destination, stat)
// }
if (source === realPathFile) {
return this.copyFileOrData(undefined, source, destination, stat)
} else {
Expand Down Expand Up @@ -147,12 +147,10 @@ export class AsarPackager {
await fs.mkdir(path.dirname(destination), { recursive: true })

if (data) {
await fs.writeFile(destination, data)
await fs.writeFile(destination, data, { mode: stat.mode })
} else {
// await this.fileCopier.copy(source, destination, stat)
await fs.copyFile(source, destination)
}
await fs.chmod(destination, stat.mode)
}
}

Expand Down Expand Up @@ -208,15 +206,3 @@ function orderFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {
transformedFiles,
}
}

function writeSymbolicLink(file: string, writePath: string) {
return new Promise((resolve, reject) => {
fs.symlink(file, writePath, function (err) {
if (err && err.code !== "EEXIST") {
return reject(err)
}

resolve(file)
})
})
}

0 comments on commit 6bc33aa

Please sign in to comment.