Skip to content

Commit 44f0b51

Browse files
committed
Fix autoload path when installed as composer dependency
1 parent 14da745 commit 44f0b51

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

res/sqlite-worker.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
use Clue\React\NDJson\Decoder;
77
use Clue\React\NDJson\Encoder;
88

9-
require __DIR__ . '/../vendor/autoload.php';
9+
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
10+
// local project development, go from /res to /vendor
11+
require __DIR__ . '/../vendor/autoload.php';
12+
} else {
13+
// project installed as dependency, go upwards from /vendor/clue/reactphp-sqlite/res
14+
require __DIR__ . '/../../../autoload.php';
15+
}
1016

1117
$loop = Factory::create();
1218
$in = new Decoder(new ReadableResourceStream(\STDIN, $loop));

0 commit comments

Comments
 (0)