Skip to content

Commit

Permalink
Merge pull request #5 from KeizerDev/fix-path
Browse files Browse the repository at this point in the history
Used REALPATH to prevent dots in path as a result of strange behaviour with chrome headless
  • Loading branch information
DaanDeSmedt authored Mar 12, 2018
2 parents 0750b42 + 4bce3f1 commit 76c3ba6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk


.idea/
4 changes: 2 additions & 2 deletions src/HeadlessChrome.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public function setUrl($url) {
*/
public function setOutputDirectory($directory)
{
$this->outputDirectory = trim($directory);
if (!file_exists($directory)) {
if (!file_exists($directory) || !realpath($directory)) {
@mkdir($directory);
}
$this->outputDirectory = realpath(trim($directory));
}


Expand Down
2 changes: 1 addition & 1 deletion tests/HeadlessChromeTestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testSetURL() {
public function testSetOutputDirectory() {
$headlessChromer = new HeadlessChrome();
$headlessChromer->setOutputDirectory($this->ouputDirectory);
$this->assertEquals($this->ouputDirectory, $headlessChromer->getOutputDirectory());
$this->assertEquals(realpath($this->ouputDirectory), $headlessChromer->getOutputDirectory());
}


Expand Down

0 comments on commit 76c3ba6

Please sign in to comment.