@@ -15,7 +15,6 @@ Date: June 2006
15
15
16
16
#include < util/cmdline.h>
17
17
#include < util/config.h>
18
- #include < util/file_util.h>
19
18
#include < util/get_base_name.h>
20
19
#include < util/prefix.h>
21
20
#include < util/run.h>
@@ -39,6 +38,7 @@ Date: June 2006
39
38
#include < linking/static_lifetime_init.h>
40
39
41
40
#include < cstring>
41
+ #include < filesystem>
42
42
#include < fstream>
43
43
#include < iostream>
44
44
@@ -217,11 +217,14 @@ bool compilet::add_files_from_archive(
217
217
tstr = get_temporary_directory (" goto-cc.XXXXXX" );
218
218
219
219
tmp_dirs.push_back (tstr);
220
- set_current_path (tmp_dirs.back ());
220
+ std::filesystem::current_path (tmp_dirs.back ());
221
221
222
222
// unpack now
223
- int ret =
224
- run (" ar" , {" ar" , " x" , concat_dir_file (working_directory, file_name)});
223
+ int ret = run (
224
+ " ar" ,
225
+ {" ar" ,
226
+ " x" ,
227
+ std::filesystem::path (working_directory).append (file_name).string ()});
225
228
if (ret != 0 )
226
229
{
227
230
log .error () << " Failed to extract archive " << file_name << messaget::eom;
@@ -233,7 +236,9 @@ bool compilet::add_files_from_archive(
233
236
temporary_filet tmp_file_out (" " , " " );
234
237
int ret = run (
235
238
" ar" ,
236
- {" ar" , " t" , concat_dir_file (working_directory, file_name)},
239
+ {" ar" ,
240
+ " t" ,
241
+ std::filesystem::path (working_directory).append (file_name).string ()},
237
242
" " ,
238
243
tmp_file_out (),
239
244
" " );
@@ -248,7 +253,7 @@ bool compilet::add_files_from_archive(
248
253
249
254
while (!in.fail () && std::getline (in, line))
250
255
{
251
- std::string t = concat_dir_file (tstr, line);
256
+ std::string t = std::filesystem::path (tstr). append ( line). string ( );
252
257
253
258
if (is_goto_binary (t, log .get_message_handler ()))
254
259
object_files.push_back (t);
@@ -258,7 +263,7 @@ bool compilet::add_files_from_archive(
258
263
}
259
264
260
265
if (!thin_archive)
261
- set_current_path (working_directory);
266
+ std::filesystem::current_path (working_directory);
262
267
263
268
return false ;
264
269
}
@@ -272,15 +277,18 @@ bool compilet::find_library(const std::string &name)
272
277
273
278
for (const auto &library_path : library_paths)
274
279
{
275
- library_file_name = concat_dir_file (library_path, " lib" + name + " .a" );
280
+ library_file_name =
281
+ std::filesystem::path (library_path).append (" lib" + name + " .a" ).string ();
276
282
277
283
std::ifstream in (library_file_name);
278
284
279
285
if (in.is_open ())
280
286
return !add_input_file (library_file_name);
281
287
else
282
288
{
283
- library_file_name = concat_dir_file (library_path, " lib" + name + " .so" );
289
+ library_file_name = std::filesystem::path (library_path)
290
+ .append (" lib" + name + " .so" )
291
+ .string ();
284
292
285
293
switch (detect_file_type (library_file_name, log .get_message_handler ()))
286
294
{
@@ -409,7 +417,11 @@ optionalt<symbol_tablet> compilet::compile()
409
417
get_base_name (file_name, true ) + " ." + object_file_extension;
410
418
411
419
if (!output_directory_object.empty ())
412
- cfn = concat_dir_file (output_directory_object, file_name_with_obj_ext);
420
+ {
421
+ cfn = std::filesystem::path (output_directory_object)
422
+ .append (file_name_with_obj_ext)
423
+ .string ();
424
+ }
413
425
else
414
426
cfn = file_name_with_obj_ext;
415
427
}
@@ -648,7 +660,7 @@ compilet::compilet(cmdlinet &_cmdline, message_handlert &mh, bool Werror)
648
660
mode=COMPILE_LINK_EXECUTABLE;
649
661
echo_file_name=false ;
650
662
wrote_object=false ;
651
- working_directory= get_current_working_directory ();
663
+ working_directory = std::filesystem::current_path (). string ();
652
664
653
665
if (cmdline.isset (" export-function-local-symbols" ))
654
666
{
@@ -665,7 +677,7 @@ compilet::~compilet()
665
677
// clean up temp dirs
666
678
667
679
for (const auto &dir : tmp_dirs)
668
- delete_directory (dir);
680
+ std::filesystem::remove_all (dir);
669
681
}
670
682
671
683
std::size_t compilet::function_body_count (const goto_functionst &functions)
0 commit comments