Skip to content

Commit a45c45a

Browse files
authored
Leverage fs.stat to ensure it works by Electron package (#1375)
This pull request updates file system operations to improve compatibility with Electron's ASAR packaging system by replacing `fs.access()` with `fs.stat()` for existence checks. This is important since the project explicitly targets Electron (as seen in `package.json` with `--target electron@23.0.0`). **Changes:** - Replaced `fs.access()` with `fs.stat()` in the `findPackagesInDirectory` function - Replaced `fsPromises.access()` with `fsPromises.stat()` in the `pathExists` utility function Fix: #1375
1 parent 7767051 commit a45c45a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function ensureDirSync(dirPath) {
5454
*/
5555
async function pathExists(filePath) {
5656
try {
57-
await fsPromises.access(filePath);
57+
await fsPromises.stat(filePath);
5858
return true;
5959
} catch {
6060
return false;

rosidl_gen/packages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ async function findPackagesInDirectory(dir, useIDL) {
223223

224224
// If there is a folder named 'share' under the root path, we consider that
225225
// the ament build tool has been executed and |amentExecuted| will be true.
226-
fs.access(path.join(dir, 'share'), (err) => {
226+
fs.stat(path.join(dir, 'share'), (err) => {
227227
if (err) {
228228
amentExecuted = false;
229229
}

0 commit comments

Comments
 (0)