Skip to content

Commit 76c3ba6

Browse files
authored
Merge pull request #5 from KeizerDev/fix-path
Used REALPATH to prevent dots in path as a result of strange behaviour with chrome headless
2 parents 0750b42 + 4bce3f1 commit 76c3ba6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ $RECYCLE.BIN/
5555

5656
# Windows shortcuts
5757
*.lnk
58+
59+
60+
.idea/

src/HeadlessChrome.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ public function setUrl($url) {
130130
*/
131131
public function setOutputDirectory($directory)
132132
{
133-
$this->outputDirectory = trim($directory);
134-
if (!file_exists($directory)) {
133+
if (!file_exists($directory) || !realpath($directory)) {
135134
@mkdir($directory);
136135
}
136+
$this->outputDirectory = realpath(trim($directory));
137137
}
138138

139139

tests/HeadlessChromeTestSuite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testSetURL() {
3434
public function testSetOutputDirectory() {
3535
$headlessChromer = new HeadlessChrome();
3636
$headlessChromer->setOutputDirectory($this->ouputDirectory);
37-
$this->assertEquals($this->ouputDirectory, $headlessChromer->getOutputDirectory());
37+
$this->assertEquals(realpath($this->ouputDirectory), $headlessChromer->getOutputDirectory());
3838
}
3939

4040

0 commit comments

Comments
 (0)