@@ -35,6 +35,10 @@ pub fn tmp_dir() -> PathBuf {
35
35
env:: var_os ( "TMPDIR" ) . unwrap ( ) . into ( )
36
36
}
37
37
38
+ pub fn tmp_path < P : AsRef < Path > > ( path : P ) -> PathBuf {
39
+ tmp_dir ( ) . join ( path. as_ref ( ) )
40
+ }
41
+
38
42
/// `TARGET`
39
43
pub fn target ( ) -> String {
40
44
env:: var ( "TARGET" ) . unwrap ( )
@@ -58,7 +62,7 @@ pub fn is_darwin() -> bool {
58
62
/// Construct a path to a static library under `$TMPDIR` given the library name. This will return a
59
63
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
60
64
pub fn static_lib ( name : & str ) -> PathBuf {
61
- tmp_dir ( ) . join ( static_lib_name ( name) )
65
+ tmp_path ( static_lib_name ( name) )
62
66
}
63
67
64
68
pub fn python_command ( ) -> Command {
@@ -103,7 +107,7 @@ pub fn static_lib_name(name: &str) -> String {
103
107
/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a
104
108
/// path with `$TMPDIR` joined with platform-and-compiler-specific library name.
105
109
pub fn dynamic_lib ( name : & str ) -> PathBuf {
106
- tmp_dir ( ) . join ( dynamic_lib_name ( name) )
110
+ tmp_path ( dynamic_lib_name ( name) )
107
111
}
108
112
109
113
/// Construct the dynamic library name based on the platform.
@@ -135,7 +139,7 @@ pub fn dynamic_lib_name(name: &str) -> String {
135
139
/// Construct a path to a rust library (rlib) under `$TMPDIR` given the library name. This will return a
136
140
/// path with `$TMPDIR` joined with the library name.
137
141
pub fn rust_lib ( name : & str ) -> PathBuf {
138
- tmp_dir ( ) . join ( rust_lib_name ( name) )
142
+ tmp_path ( rust_lib_name ( name) )
139
143
}
140
144
141
145
/// Generate the name a rust library (rlib) would have. If you want the complete path, use
0 commit comments