55#define MAX_ARGS 32
66
77static const char * argv_exec_path ;
8+
9+ #ifdef RUNTIME_PREFIX
810static const char * argv0_path ;
911
10- char * system_path ( const char * path )
12+ static const char * system_prefix ( void )
1113{
12- #ifdef RUNTIME_PREFIX
1314 static const char * prefix ;
14- #else
15- static const char * prefix = PREFIX ;
16- #endif
17- struct strbuf d = STRBUF_INIT ;
18-
19- if (is_absolute_path (path ))
20- return xstrdup (path );
2115
22- #ifdef RUNTIME_PREFIX
2316 assert (argv0_path );
2417 assert (is_absolute_path (argv0_path ));
2518
@@ -32,10 +25,7 @@ char *system_path(const char *path)
3225 "but prefix computation failed. "
3326 "Using static fallback '%s'.\n" , prefix );
3427 }
35- #endif
36-
37- strbuf_addf (& d , "%s/%s" , prefix , path );
38- return strbuf_detach (& d , NULL );
28+ return prefix ;
3929}
4030
4131void git_extract_argv0_path (const char * argv0 )
@@ -51,6 +41,30 @@ void git_extract_argv0_path(const char *argv0)
5141 argv0_path = xstrndup (argv0 , slash - argv0 );
5242}
5343
44+ #else
45+
46+ static const char * system_prefix (void )
47+ {
48+ return PREFIX ;
49+ }
50+
51+ void git_extract_argv0_path (const char * argv0 )
52+ {
53+ }
54+
55+ #endif /* RUNTIME_PREFIX */
56+
57+ char * system_path (const char * path )
58+ {
59+ struct strbuf d = STRBUF_INIT ;
60+
61+ if (is_absolute_path (path ))
62+ return xstrdup (path );
63+
64+ strbuf_addf (& d , "%s/%s" , system_prefix (), path );
65+ return strbuf_detach (& d , NULL );
66+ }
67+
5468void git_set_argv_exec_path (const char * exec_path )
5569{
5670 argv_exec_path = exec_path ;
0 commit comments