fixed --casper-path arg parsing
Showing
1 changed file
with
14 additions
and
7 deletions
... | @@ -63,14 +63,21 @@ if (!phantom.casperLoaded) { | ... | @@ -63,14 +63,21 @@ if (!phantom.casperLoaded) { |
63 | })(require('fs')); | 63 | })(require('fs')); |
64 | 64 | ||
65 | // casper root path | 65 | // casper root path |
66 | // TODO: take --casper-path=.* from python executable | ||
67 | if (!phantom.casperPath) { | 66 | if (!phantom.casperPath) { |
68 | phantom.casperPath = fs.absolute(phantom.args.map(function(arg) { | 67 | try { |
69 | var match = arg.match(/--casper-path=(.*)/i); | 68 | phantom.casperPath = phantom.args.map(function(i) { |
70 | if (match) { | 69 | var match = i.match(/^--casper-path=(.*)/); |
71 | return match[1]; | 70 | if (match) { |
72 | } | 71 | return fs.absolute(match[1]); |
73 | }).pop()); | 72 | } |
73 | }).filter(function(path) { | ||
74 | return fs.isDirectory(path); | ||
75 | }).pop(); | ||
76 | } catch (e) {} | ||
77 | } | ||
78 | if (!phantom.casperPath) { | ||
79 | console.error("Couldn't find not compute phantom.casperPath, exiting."); | ||
80 | phantom.exit(1); | ||
74 | } | 81 | } |
75 | 82 | ||
76 | // Embedded, up-to-date, validatable & controlable CoffeeScript | 83 | // Embedded, up-to-date, validatable & controlable CoffeeScript | ... | ... |
-
Please register or sign in to post a comment