File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,22 @@ import * as _credits from './credits.js'
66
77import * as generate from './src/generate.ts'
88
9+ const exists = async ( filename : string ) : Promise < boolean > => {
10+ try {
11+ await Deno . stat ( filename ) ;
12+ // successful, file or directory must exist
13+ return true ;
14+ } catch ( error ) {
15+ if ( error instanceof Deno . errors . NotFound ) {
16+ // file or directory does not exist
17+ return false ;
18+ } else {
19+ // unexpected error, maybe permissions, pass it along
20+ throw error ;
21+ }
22+ }
23+ } ;
24+
925let decoder = new TextDecoder ( 'utf-8' )
1026export const config : IConfig = {
1127 imagePath : path . resolve ( './img/' ) ,
@@ -21,6 +37,10 @@ for (let item of Deno.readDirSync(path.resolve('./')))
2137{
2238 console . log ( `- ${ item . name } ` + ( item . isDirectory ? ' (directory)' : '' ) )
2339}
40+ if ( ! exists ( config . distPath ) )
41+ {
42+ Deno . mkdirSync ( config . distPath ) ;
43+ }
2444console . log ( `Reading all files in ${ config . distPath } ` ) ;
2545for ( let item of Deno . readDirSync ( config . distPath ) )
2646{
You can’t perform that action at this time.
0 commit comments