| 106 | } |
| 107 | |
| 108 | function isGlobalByPath(installPath: string): boolean { |
| 109 | // This is true for e.g. nvm, node path will be equal to now path |
| 110 | if (dirname(process.argv[0]) === dirname(process.argv[1])) { |
| 111 | return true; |
| 112 | } |
| 113 | |
| 114 | if ( |
| 115 | installPath.includes(['', 'yarn', 'global', 'node_modules', ''].join(sep)) |
| 116 | ) { |
| 117 | return true; |
| 118 | } |
| 119 | |
| 120 | if (installPath.includes(['', 'pnpm', 'global', ''].join(sep))) { |
| 121 | return true; |
| 122 | } |
| 123 | |
| 124 | if (installPath.includes(['', 'fnm', 'node-versions', ''].join(sep))) { |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | async function isGlobalByPrefix(installPath: string): Promise<boolean> { |
| 132 | const isWindows = process.platform === 'win32'; |