5
5
#define MAX_ARGS 32
6
6
7
7
static const char * argv_exec_path ;
8
+
9
+ #ifdef RUNTIME_PREFIX
8
10
static const char * argv0_path ;
9
11
10
- char * system_path ( const char * path )
12
+ static const char * system_prefix ( void )
11
13
{
12
- #ifdef RUNTIME_PREFIX
13
14
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 );
21
15
22
- #ifdef RUNTIME_PREFIX
23
16
assert (argv0_path );
24
17
assert (is_absolute_path (argv0_path ));
25
18
@@ -32,10 +25,7 @@ char *system_path(const char *path)
32
25
"but prefix computation failed. "
33
26
"Using static fallback '%s'.\n" , prefix );
34
27
}
35
- #endif
36
-
37
- strbuf_addf (& d , "%s/%s" , prefix , path );
38
- return strbuf_detach (& d , NULL );
28
+ return prefix ;
39
29
}
40
30
41
31
void git_extract_argv0_path (const char * argv0 )
@@ -51,6 +41,30 @@ void git_extract_argv0_path(const char *argv0)
51
41
argv0_path = xstrndup (argv0 , slash - argv0 );
52
42
}
53
43
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
+
54
68
void git_set_argv_exec_path (const char * exec_path )
55
69
{
56
70
argv_exec_path = exec_path ;
0 commit comments