File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as fs from 'fs' ;
2+ import * as path from 'path' ;
3+
4+ function getPath ( filePath : string ) {
5+ return path . normalize ( path . join ( window . coderoad . dir , filePath ) ) ;
6+ }
7+
8+ export function write ( filePath : string , text ) {
9+ try {
10+ fs . writeFileSync ( getPath ( filePath ) , text , 'utf8' ) ;
11+ } catch ( e ) {
12+ if ( e ) { console . log ( 'Error writing to filePath' , filePath ) ; }
13+ }
14+ }
15+
16+ export function readWrite ( writePath : string , readPath : string ) {
17+ try {
18+ write ( writePath , fs . readFileSync ( getPath ( readPath ) ) ) ;
19+ } catch ( e ) {
20+ if ( e ) { console . log ( 'Error reading from filePath' , readPath ) ; }
21+ }
22+ }
Original file line number Diff line number Diff line change 9595 " src/services/setup-actions.ts" ,
9696 " src/services/setup-checks.ts" ,
9797 " src/services/tutorials.ts" ,
98+ " src/services/write.ts" ,
9899 " src/store/initialState.ts" ,
99100 " src/store/store.ts" ,
100101 " src/components/account/account.tsx" ,
You can’t perform that action at this time.
0 commit comments