@@ -13,13 +13,8 @@ Date: June 2006
13
13
14
14
#include " compile.h"
15
15
16
- #include < cstring>
17
- #include < fstream>
18
- #include < iostream>
19
-
20
16
#include < util/cmdline.h>
21
17
#include < util/config.h>
22
- #include < util/file_util.h>
23
18
#include < util/get_base_name.h>
24
19
#include < util/prefix.h>
25
20
#include < util/run.h>
@@ -28,6 +23,11 @@ Date: June 2006
28
23
#include < util/tempfile.h>
29
24
#include < util/version.h>
30
25
26
+ #include < cstring>
27
+ #include < filesystem>
28
+ #include < fstream>
29
+ #include < iostream>
30
+
31
31
#ifdef _MSC_VER
32
32
# include < util/unicode.h>
33
33
#endif
@@ -222,11 +222,14 @@ 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
- int ret =
229
- run (" ar" , {" ar" , " x" , concat_dir_file (working_directory, file_name)});
228
+ int ret = run (
229
+ " ar" ,
230
+ {" ar" ,
231
+ " x" ,
232
+ std::filesystem::path (working_directory).append (file_name).string ()});
230
233
if (ret != 0 )
231
234
{
232
235
log .error () << " Failed to extract archive " << file_name << messaget::eom;
@@ -238,7 +241,9 @@ bool compilet::add_files_from_archive(
238
241
temporary_filet tmp_file_out (" " , " " );
239
242
int ret = run (
240
243
" ar" ,
241
- {" ar" , " t" , concat_dir_file (working_directory, file_name)},
244
+ {" ar" ,
245
+ " t" ,
246
+ std::filesystem::path (working_directory).append (file_name).string ()},
242
247
" " ,
243
248
tmp_file_out (),
244
249
" " );
@@ -253,7 +258,7 @@ bool compilet::add_files_from_archive(
253
258
254
259
while (!in.fail () && std::getline (in, line))
255
260
{
256
- std::string t = concat_dir_file (tstr, line);
261
+ std::string t = std::filesystem::path (tstr). append ( line). string ( );
257
262
258
263
if (is_goto_binary (t, log .get_message_handler ()))
259
264
object_files.push_back (t);
@@ -263,7 +268,7 @@ bool compilet::add_files_from_archive(
263
268
}
264
269
265
270
if (!thin_archive)
266
- set_current_path (working_directory);
271
+ std::filesystem::current_path (working_directory);
267
272
268
273
return false ;
269
274
}
@@ -277,15 +282,18 @@ bool compilet::find_library(const std::string &name)
277
282
278
283
for (const auto &library_path : library_paths)
279
284
{
280
- library_file_name = concat_dir_file (library_path, " lib" + name + " .a" );
285
+ library_file_name =
286
+ std::filesystem::path (library_path).append (" lib" + name + " .a" ).string ();
281
287
282
288
std::ifstream in (library_file_name);
283
289
284
290
if (in.is_open ())
285
291
return !add_input_file (library_file_name);
286
292
else
287
293
{
288
- library_file_name = concat_dir_file (library_path, " lib" + name + " .so" );
294
+ library_file_name = std::filesystem::path (library_path)
295
+ .append (" lib" + name + " .so" )
296
+ .string ();
289
297
290
298
switch (detect_file_type (library_file_name, log .get_message_handler ()))
291
299
{
@@ -414,7 +422,11 @@ optionalt<symbol_tablet> compilet::compile()
414
422
get_base_name (file_name, true ) + " ." + object_file_extension;
415
423
416
424
if (!output_directory_object.empty ())
417
- cfn = concat_dir_file (output_directory_object, file_name_with_obj_ext);
425
+ {
426
+ cfn = std::filesystem::path (output_directory_object)
427
+ .append (file_name_with_obj_ext)
428
+ .string ();
429
+ }
418
430
else
419
431
cfn = file_name_with_obj_ext;
420
432
}
@@ -657,7 +669,7 @@ compilet::compilet(cmdlinet &_cmdline, message_handlert &mh, bool Werror)
657
669
mode=COMPILE_LINK_EXECUTABLE;
658
670
echo_file_name=false ;
659
671
wrote_object=false ;
660
- working_directory= get_current_working_directory ();
672
+ working_directory = std::filesystem::current_path (). string ();
661
673
662
674
if (cmdline.isset (" export-function-local-symbols" ))
663
675
{
@@ -674,7 +686,7 @@ compilet::~compilet()
674
686
// clean up temp dirs
675
687
676
688
for (const auto &dir : tmp_dirs)
677
- delete_directory (dir);
689
+ std::filesystem::remove_all (dir);
678
690
}
679
691
680
692
std::size_t compilet::function_body_count (const goto_functionst &functions)
0 commit comments