src/rss_converter_pump.io.xsl: fix getting the channel logo URL
[tweeper.git] / tweeper
diff --git a/tweeper b/tweeper
index a13752f..d4b04e3 100755 (executable)
--- a/tweeper
+++ b/tweeper
@@ -1,4 +1,22 @@
 #!/usr/bin/env php
 <?php
 
-require(dirname(__FILE__) . '/tweeper.php');
+/**
+ * @file
+ * CLI file to run tweeper.
+ */
+
+if (preg_match('/' . preg_quote('/vendor/bin', '/') . '$/', __DIR__)) {
+  /*
+   * This covers the case of tweeper running from a "vendor/bin" directory in
+   * a composer setup, but with the tweeper executable _not_ being a symlink.
+   *
+   * This can happen when the filesystem does not support symlinks.
+   */
+  $package_name = 'ao2/tweeper';
+  require __DIR__ . '/../' . $package_name . '/tweeper.php';
+}
+else {
+  /* For the other cases look at the autoload.php required by tweeper.php */
+  require __DIR__ . '/tweeper.php';
+}