mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
fs.statSync(fs.realpathSync()) for fileExistsSync
This commit is contained in:
parent
8e161f8241
commit
260c5e341d
1 changed files with 1 additions and 4 deletions
|
@ -147,10 +147,9 @@ export function fileExistsSync(path: string): boolean {
|
||||||
throw new Error("Arg 'path' must not be empty")
|
throw new Error("Arg 'path' must not be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
const fd = fs.openSync(path, 'r')
|
|
||||||
let stats: fs.Stats
|
let stats: fs.Stats
|
||||||
try {
|
try {
|
||||||
stats = fs.fstatSync(fd)
|
stats = fs.statSync(fs.realpathSync(path))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (hasErrorCode(error) && error.code === 'ENOENT') {
|
if (hasErrorCode(error) && error.code === 'ENOENT') {
|
||||||
return false
|
return false
|
||||||
|
@ -161,8 +160,6 @@ export function fileExistsSync(path: string): boolean {
|
||||||
error
|
error
|
||||||
)}`
|
)}`
|
||||||
)
|
)
|
||||||
} finally {
|
|
||||||
fs.closeSync(fd)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stats.isDirectory()) {
|
if (!stats.isDirectory()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue