MCPcopy Create free account
hub / github.com/boostorg/build / path_build

Function path_build

v2/engine/pathsys.c:165–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163 */
164
165void path_build( PATHNAME * f, string * file )
166{
167 file_build1( f, file );
168
169 /* Do not prepend root if it is '.' or the directory is rooted. */
170 if ( f->f_root.len
171 && !( f->f_root.len == 1 && f->f_root.ptr[ 0 ] == '.' )
172 && !( f->f_dir.len && f->f_dir.ptr[ 0 ] == '/' )
173#if PATH_DELIM == '\\'
174 && !( f->f_dir.len && f->f_dir.ptr[ 0 ] == '\\' )
175 && !( f->f_dir.len && f->f_dir.ptr[ 1 ] == ':' )
176#endif
177 )
178 {
179 string_append_range( file, f->f_root.ptr, f->f_root.ptr + f->f_root.len
180 );
181 /* If 'root' already ends with a path delimeter, do not add another one.
182 */
183 if ( !is_path_delim( f->f_root.ptr[ f->f_root.len - 1 ] ) )
184 string_push_back( file, as_path_delim( f->f_root.ptr[ f->f_root.len
185 ] ) );
186 }
187
188 if ( f->f_dir.len )
189 string_append_range( file, f->f_dir.ptr, f->f_dir.ptr + f->f_dir.len );
190
191 /* Put path separator between dir and file. */
192 /* Special case for root dir: do not add another path separator. */
193 if ( f->f_dir.len && ( f->f_base.len || f->f_suffix.len )
194#if PATH_DELIM == '\\'
195 && !( f->f_dir.len == 3 && f->f_dir.ptr[ 1 ] == ':' )
196#endif
197 && !( f->f_dir.len == 1 && is_path_delim( f->f_dir.ptr[ 0 ] ) ) )
198 string_push_back( file, as_path_delim( f->f_dir.ptr[ f->f_dir.len ] ) );
199
200 if ( f->f_base.len )
201 string_append_range( file, f->f_base.ptr, f->f_base.ptr + f->f_base.len
202 );
203
204 if ( f->f_suffix.len )
205 string_append_range( file, f->f_suffix.ptr, f->f_suffix.ptr +
206 f->f_suffix.len );
207
208 if ( f->f_member.len )
209 {
210 string_push_back( file, '(' );
211 string_append_range( file, f->f_member.ptr, f->f_member.ptr +
212 f->f_member.len );
213 string_push_back( file, ')' );
214 }
215}
216
217
218/*

Callers 7

builtin_glob_backFunction · 0.85
glob_recursiveFunction · 0.85
set_explicit_bindingFunction · 0.85
searchFunction · 0.85
var_edit_fileFunction · 0.85

Calls 5

file_build1Function · 0.85
string_append_rangeFunction · 0.85
is_path_delimFunction · 0.85
string_push_backFunction · 0.85
as_path_delimFunction · 0.85

Tested by

no test coverage detected