mirror of
https://github.com/ryan-haskell/elm-spa.git
synced 2024-09-11 12:35:44 +03:00
Merge pull request #43 from drshade/master
check whether the folder exists before attempting to create it, avoid…
This commit is contained in:
commit
7b40c81e17
@ -37,7 +37,7 @@ const listFiles = (dir) =>
|
||||
[])
|
||||
|
||||
const ensureDirectory = (dir) =>
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
fs.existsSync(dir) || fs.mkdirSync(dir, { recursive: true })
|
||||
|
||||
const saveToFolder = (prefix) => ({ filepath, content }) =>
|
||||
fs.writeFileSync(path.join(prefix, filepath), content, { encoding: 'utf8' })
|
||||
|
Loading…
Reference in New Issue
Block a user