forked from jywarren/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* resolves #131 create output directory immediately Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix error if no steps are passed Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add exit message if steps not passed Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add test for creating output directory
- Loading branch information
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const fs = require('fs') | ||
|
||
|
||
|
||
/* | ||
* This function checks if the directory exists, if not it creates one on the given path | ||
* Callback is called with argument error if an error is encountered | ||
*/ | ||
function makedir(path,callback){ | ||
fs.access(path,function(err){ | ||
if(err) fs.mkdir(path,function(err){ | ||
if(err) callback(err); | ||
callback(); | ||
}); | ||
else callback() | ||
}); | ||
}; | ||
|
||
module.exports = exports = { | ||
makedir: makedir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const cliUtils = require('../src/CliUtils'); | ||
const test = require('tape'); | ||
|
||
test('Output directory is correctly generated',function(t){ | ||
cliUtils.makedir('./output/',function(){ | ||
require('fs').access('./output/.',function(err){ | ||
t.true(!err,"Access the created dir") | ||
t.end() | ||
}); | ||
}); | ||
}); |