1- import fs from " node:fs" ;
2- import path from " node:path" ;
1+ import fs from ' node:fs' ;
2+ import path from ' node:path' ;
33
44export function detectRadonIdeExtensionPath ( ) : string | undefined {
5- const homeDir = process . env . HOME || process . env . USERPROFILE ;
6- if ( ! homeDir ) {
7- return undefined ;
8- }
9-
10- // Check VSCode extensions
11- const vscodeExtPath = path . join ( homeDir , '.vscode' , 'extensions' ) ;
12-
13- // Check Cursor extensions
14- const cursorExtPaths = path . join ( homeDir , '.cursor' , 'extensions' )
15-
16- const searchPaths = [ vscodeExtPath , cursorExtPaths ] ;
17-
18- for ( const searchPath of searchPaths ) {
19- if ( fs . existsSync ( searchPath ) ) {
20- const entries = fs . readdirSync ( searchPath ) ;
21- // Match exact version: swmansion.react-native-ide-1.14.2-{platform}
22- const radonFolder = entries . find ( ( entry ) => / ^ s w m a n s i o n \. r e a c t - n a t i v e - i d e - 1 \. 1 4 \. 2 - .+ $ / . test ( entry ) ) ;
23- if ( radonFolder ) {
24- const fullPath = path . join ( searchPath , radonFolder ) ;
25- console . log ( `[Radon] Found extension at: ${ fullPath } ` ) ;
26- return fullPath ;
27- }
5+ const homeDir = process . env . HOME || process . env . USERPROFILE ;
6+ if ( ! homeDir ) {
7+ return undefined ;
8+ }
9+
10+ // Check VSCode extensions
11+ const vscodeExtPath = path . join ( homeDir , '.vscode' , 'extensions' ) ;
12+
13+ // Check Cursor extensions
14+ const cursorExtPaths = path . join ( homeDir , '.cursor' , 'extensions' ) ;
15+
16+ const searchPaths = [ vscodeExtPath , cursorExtPaths ] ;
17+
18+ for ( const searchPath of searchPaths ) {
19+ if ( fs . existsSync ( searchPath ) ) {
20+ const entries = fs . readdirSync ( searchPath ) ;
21+ // Match exact version: swmansion.react-native-ide-1.14.2-{platform}
22+ const radonFolder = entries . find ( ( entry ) => / ^ s w m a n s i o n \. r e a c t - n a t i v e - i d e - 1 \. 1 4 \. 2 - .+ $ / . test ( entry ) ) ;
23+ if ( radonFolder ) {
24+ const fullPath = path . join ( searchPath , radonFolder ) ;
25+ console . log ( `[Radon] Found extension at: ${ fullPath } ` ) ;
26+ return fullPath ;
2827 }
2928 }
30-
31- console . warn ( '[Radon] Extension not found' ) ;
32- return undefined ;
33- }
29+ }
30+
31+ console . warn ( '[Radon] Extension not found' ) ;
32+ return undefined ;
33+ }
0 commit comments