@@ -15,7 +15,15 @@ async function protoParserFunc(protoBodyData) {
15
15
let protoID = Math . floor ( Math . random ( ) * 10000 ) ;
16
16
//if file path for that ID already exists, increment the ID
17
17
try {
18
- while ( fs . existsSync ( 'src/client/components/composer/protos/' + protoID + '.proto' ) ) {
18
+ if ( ! fs . existsSync ( path . join ( process . cwd ( ) , '/protos/' ) ) ) {
19
+ fs . mkdirSync ( path . join ( process . cwd ( ) , '/protos/' ) ) ;
20
+ }
21
+ } catch ( err ) {
22
+ console . error ( err )
23
+ }
24
+
25
+ try {
26
+ while ( fs . existsSync ( path . join ( process . cwd ( ) , '/protos/' + protoID + '.proto' ) ) ) {
19
27
//if file name exists try incrementing by 1
20
28
protoID += 1 ;
21
29
}
@@ -25,11 +33,13 @@ async function protoParserFunc(protoBodyData) {
25
33
// const dirName = remote.app.getAppPath(); // remote.app.getAppPath() stopped working at some point so switched to process.cwd()
26
34
27
35
// write to saveProto file for interaction with the server
28
- fs . writeFileSync ( path . join ( process . cwd ( ) , 'src/client/components/composer /protos/' + protoID + '.proto' ) , protoBodyData , 'utf-8' ) ;
36
+ fs . writeFileSync ( path . join ( process . cwd ( ) , '/protos/' + protoID + '.proto' ) , protoBodyData , 'utf-8' ) ;
29
37
30
38
// define the modular client for testing
31
39
// declare path variable of imported proto file
32
- const PROTO_PATH = path . join ( process . cwd ( ) , 'src/client/components/composer/protos/' + protoID + '.proto' ) ;
40
+
41
+
42
+ const PROTO_PATH = path . join ( process . cwd ( ) , '/protos/' + protoID + '.proto' ) ;
33
43
34
44
// create gRPC package options
35
45
const protoOptionsObj = {
0 commit comments