Move computation of absolute paths from Makefile to runtime (in preparation for RUNTIME_PREFIX)
[gitweb.git] / exec_cmd.c
index cdd35f91954bdc751455e1083a0612a21eeadc67..114d6389e4703416aa2525bf9f81dd9597d627d4 100644 (file)
@@ -9,11 +9,14 @@ static const char *argv0_path;
 
 const char *system_path(const char *path)
 {
-       if (!is_absolute_path(path) && argv0_path) {
-               struct strbuf d = STRBUF_INIT;
-               strbuf_addf(&d, "%s/%s", argv0_path, path);
-               path = strbuf_detach(&d, NULL);
-       }
+       static const char *prefix = PREFIX;
+       struct strbuf d = STRBUF_INIT;
+
+       if (is_absolute_path(path))
+               return path;
+
+       strbuf_addf(&d, "%s/%s", prefix, path);
+       path = strbuf_detach(&d, NULL);
        return path;
 }