LIBGUESTFS_PATH implementation.
[libguestfs.git] / fish / fish.c
index 90f3a10..0fc14ce 100644 (file)
@@ -78,14 +78,14 @@ usage (void)
           "  ...\n"
           "  EOF\n"
           "Options:\n"
-          "  -h|--cmd-help       List available commands\n"
-          "  -h|--cmd-help cmd   Display detailed help on 'cmd'\n"
-          "  -a image            Add image\n"
-          "  -m dev[:mnt]        Mount dev on mnt (if omitted, /)\n"
-          "  -n|--no-sync        Don't autosync\n"
-          /*"  --ro|-r             All mounts are read-only\n"*/
-          "  -v|--verbose        Verbose messages\n"
-          "For more information, see the manpage guestfish(1).\n");
+          "  -h|--cmd-help        List available commands\n"
+          "  -h|--cmd-help cmd    Display detailed help on 'cmd'\n"
+          "  -a|--add image       Add image\n"
+          "  -m|--mount dev[:mnt] Mount dev on mnt (if omitted, /)\n"
+          "  -n|--no-sync         Don't autosync\n"
+        /*"  --ro|-r              All mounts are read-only\n"*/
+          "  -v|--verbose         Verbose messages\n"
+          "For more information,  see the manpage guestfish(1).\n");
 }
 
 int
@@ -117,6 +117,14 @@ main (int argc, char *argv[])
 
   guestfs_set_autosync (g, 1);
 
+  /* If developing, add . to the path.  Note that libtools interferes
+   * with this because uninstalled guestfish is a shell script that runs
+   * the real program with an absolute path.  Detect that too.
+   */
+  if (argv[0] &&
+      (argv[0][0] != '/' || strstr (argv[0], "/.libs/lt-") != NULL))
+    guestfs_set_path (g, ".:" GUESTFS_DEFAULT_PATH);
+
   for (;;) {
     c = getopt_long (argc, argv, options, long_options, NULL);
     if (c == -1) break;