@@ -14,12 +14,12 @@ Date: June 2006
14
14
#include " compile.h"
15
15
16
16
#include < cstring>
17
+ #include < filesystem>
17
18
#include < fstream>
18
19
#include < iostream>
19
20
20
21
#include < util/cmdline.h>
21
22
#include < util/config.h>
22
- #include < util/file_util.h>
23
23
#include < util/get_base_name.h>
24
24
#include < util/prefix.h>
25
25
#include < util/run.h>
@@ -222,11 +222,11 @@ bool compilet::add_files_from_archive(
222
222
tstr = get_temporary_directory (" goto-cc.XXXXXX" );
223
223
224
224
tmp_dirs.push_back (tstr);
225
- set_current_path (tmp_dirs.back ());
225
+ std::filesystem::current_path (tmp_dirs.back ());
226
226
227
227
// unpack now
228
228
int ret =
229
- run (" ar" , {" ar" , " x" , concat_dir_file (working_directory, file_name)});
229
+ run (" ar" , {" ar" , " x" , std::filesystem::path (working_directory). append ( file_name)});
230
230
if (ret != 0 )
231
231
{
232
232
log .error () << " Failed to extract archive " << file_name << messaget::eom;
@@ -238,7 +238,7 @@ bool compilet::add_files_from_archive(
238
238
temporary_filet tmp_file_out (" " , " " );
239
239
int ret = run (
240
240
" ar" ,
241
- {" ar" , " t" , concat_dir_file (working_directory, file_name)},
241
+ {" ar" , " t" , std::filesystem::path (working_directory). append ( file_name)},
242
242
" " ,
243
243
tmp_file_out (),
244
244
" " );
@@ -253,7 +253,7 @@ bool compilet::add_files_from_archive(
253
253
254
254
while (!in.fail () && std::getline (in, line))
255
255
{
256
- std::string t = concat_dir_file (tstr, line);
256
+ std::string t = std::filesystem::path (tstr). append ( line);
257
257
258
258
if (is_goto_binary (t, log .get_message_handler ()))
259
259
object_files.push_back (t);
@@ -263,7 +263,7 @@ bool compilet::add_files_from_archive(
263
263
}
264
264
265
265
if (!thin_archive)
266
- set_current_path (working_directory);
266
+ std::filesystem::current_path (working_directory);
267
267
268
268
return false ;
269
269
}
@@ -277,15 +277,15 @@ bool compilet::find_library(const std::string &name)
277
277
278
278
for (const auto &library_path : library_paths)
279
279
{
280
- library_file_name = concat_dir_file (library_path, " lib" + name + " .a" );
280
+ library_file_name = std::filesystem::path (library_path). append ( " lib" + name + " .a" );
281
281
282
282
std::ifstream in (library_file_name);
283
283
284
284
if (in.is_open ())
285
285
return !add_input_file (library_file_name);
286
286
else
287
287
{
288
- library_file_name = concat_dir_file (library_path, " lib" + name + " .so" );
288
+ library_file_name = std::filesystem::path (library_path). append ( " lib" + name + " .so" );
289
289
290
290
switch (detect_file_type (library_file_name, log .get_message_handler ()))
291
291
{
@@ -414,7 +414,7 @@ optionalt<symbol_tablet> compilet::compile()
414
414
get_base_name (file_name, true ) + " ." + object_file_extension;
415
415
416
416
if (!output_directory_object.empty ())
417
- cfn = concat_dir_file (output_directory_object, file_name_with_obj_ext);
417
+ cfn = std::filesystem::path (output_directory_object). append ( file_name_with_obj_ext);
418
418
else
419
419
cfn = file_name_with_obj_ext;
420
420
}
@@ -657,7 +657,7 @@ compilet::compilet(cmdlinet &_cmdline, message_handlert &mh, bool Werror)
657
657
mode=COMPILE_LINK_EXECUTABLE;
658
658
echo_file_name=false ;
659
659
wrote_object=false ;
660
- working_directory=get_current_working_directory ();
660
+ working_directory=std::filesystem::current_path ();
661
661
662
662
if (cmdline.isset (" export-function-local-symbols" ))
663
663
{
@@ -674,7 +674,7 @@ compilet::~compilet()
674
674
// clean up temp dirs
675
675
676
676
for (const auto &dir : tmp_dirs)
677
- delete_directory (dir);
677
+ std::filesystem::remove_all (dir);
678
678
}
679
679
680
680
std::size_t compilet::function_body_count (const goto_functionst &functions)
0 commit comments