(options, noPrefix)
| 20091 | if (!p) { |
| 20092 | throw new Error('isRooted() parameter "p" cannot be empty'); |
| 20093 | } |
| 20094 | if (IS_WINDOWS) { |
| 20095 | return p.startsWith("\\") || /^[A-Z]:/i.test(p); |
| 20096 | } |
| 20097 | return p.startsWith("/"); |
| 20098 | } |
| 20099 | function tryGetExecutablePath(filePath, extensions) { |
| 20100 | return __awaiter2(this, void 0, void 0, function* () { |
| 20101 | let stats = void 0; |
| 20102 | try { |
| 20103 | stats = yield stat(filePath); |
| 20104 | } catch (err) { |
| 20105 | if (err.code !== "ENOENT") { |
| 20106 | console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); |
| 20107 | } |
| 20108 | } |
| 20109 | if (stats && stats.isFile()) { |
| 20110 | if (IS_WINDOWS) { |
| 20111 | const upperExt = path.extname(filePath).toUpperCase(); |
| 20112 | if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { |
| 20113 | return filePath; |
| 20114 | } |
| 20115 | } else { |
| 20116 | if (isUnixExecutable(stats)) { |
| 20117 | return filePath; |
| 20118 | } |
| 20119 | } |
| 20120 | } |
| 20121 | const originalFilePath = filePath; |
| 20122 | for (const extension of extensions) { |
| 20123 | filePath = originalFilePath + extension; |
| 20124 | stats = void 0; |
no test coverage detected