@@ -26,6 +26,7 @@ async function main() {
2626 '--help' : Boolean ,
2727 '--quiet' : Boolean ,
2828 '--version' : Boolean ,
29+ '--diagram-file' : String ,
2930 '--elf' : String ,
3031 '--expect-text' : String ,
3132 '--fail-text' : String ,
@@ -48,6 +49,7 @@ async function main() {
4849 const expectText = args [ '--expect-text' ] ;
4950 const failText = args [ '--fail-text' ] ;
5051 const interactive = args [ '--interactive' ] ;
52+ const diagramFile = args [ '--diagram-file' ] ;
5153 const serialLogFile = args [ '--serial-log-file' ] ;
5254 const scenarioFile = args [ '--scenario' ] ;
5355 const timeout = args [ '--timeout' ] ?? 30000 ;
@@ -76,16 +78,16 @@ async function main() {
7678 }
7779
7880 const rootDir = args . _ [ 0 ] || '.' ;
79- const configPath = ` ${ rootDir } / wokwi.toml` ;
80- const diagramFile = ` ${ rootDir } / diagram.json` ;
81+ const configPath = path . join ( rootDir , ' wokwi.toml' ) ;
82+ const diagramFilePath = path . join ( rootDir , diagramFile ?? ' diagram.json' ) ;
8183 const configExists = existsSync ( configPath ) ;
8284
8385 if ( ! elf && ! configExists ) {
8486 console . error ( `Error: wokwi.toml not found in ${ path . resolve ( rootDir ) } ` ) ;
8587 process . exit ( 1 ) ;
8688 }
8789
88- if ( ! existsSync ( diagramFile ) ) {
90+ if ( ! existsSync ( diagramFilePath ) ) {
8991 console . error ( `Error: diagram.json not found in ${ path . resolve ( rootDir ) } ` ) ;
9092 process . exit ( 1 ) ;
9193 }
@@ -117,7 +119,7 @@ async function main() {
117119 process . exit ( 1 ) ;
118120 }
119121
120- const diagram = readFileSync ( diagramFile , 'utf8' ) ;
122+ const diagram = readFileSync ( diagramFilePath , 'utf8' ) ;
121123
122124 const chips = loadChips ( config ?. chip ?? [ ] , rootDir ) ;
123125
0 commit comments