Skip to content

Commit

Permalink
Refact source argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoo committed Oct 7, 2014
1 parent d3a760b commit f3ef45c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ var DEFAULT_PORT = 8000;
var DEFAULT_ENCODE = "utf-8";

function build(cwd, options){
var fileName = options.args.join("");
var fileName = options.args[0] || "";
var encode = options.encode || DEFAULT_ENCODE;
var template_dir = path.join(__dirname, "template");
var dist_dir = options.dist || path.join(cwd, DEFAULT_DIST);

if (!fs.existsSync(fileName)) {
if (!fileName || !fs.existsSync(fileName)) {
console.error("Not Found:", fileName);
return;
}
Expand All @@ -39,9 +39,9 @@ function server(cwd, options){
var port = options.port || DEFAULT_PORT;
var encode = options.encode || DEFAULT_ENCODE;
var watch = options.watch || false;
var fileName = options.args.join("");
var fileName = options.args[0] || "";

if (!fs.existsSync(fileName)) {
if (!fileName || !fs.existsSync(fileName)) {
console.error("Not Found:", fileName);
return;
}
Expand Down

0 comments on commit f3ef45c

Please sign in to comment.