Skip to content

Commit 0a56e98

Browse files
author
Daniel Kroening
authored
Merge pull request #3693 from tautschnig/use-concat
Use concat_dir_file instead of local platform-specific code
2 parents e6ce264 + df4a90e commit 0a56e98

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/goto-cc/compile.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,31 +305,28 @@ bool compilet::add_files_from_archive(
305305
/// \return true if found, false otherwise
306306
bool compilet::find_library(const std::string &name)
307307
{
308-
std::string tmp;
308+
std::string library_file_name;
309309

310310
for(const auto &library_path : library_paths)
311311
{
312-
#ifdef _WIN32
313-
tmp = library_path + "\\lib";
314-
#else
315-
tmp = library_path + "/lib";
316-
#endif
312+
library_file_name = concat_dir_file(library_path, "lib" + name + ".a");
317313

318-
std::ifstream in(tmp+name+".a");
314+
std::ifstream in(library_file_name);
319315

320316
if(in.is_open())
321-
return !add_input_file(tmp+name+".a");
317+
return !add_input_file(library_file_name);
322318
else
323319
{
324-
std::string libname=tmp+name+".so";
320+
library_file_name = concat_dir_file(library_path, "lib" + name + ".so");
325321

326-
switch(detect_file_type(libname))
322+
switch(detect_file_type(library_file_name))
327323
{
328324
case file_typet::GOTO_BINARY:
329-
return !add_input_file(libname);
325+
return !add_input_file(library_file_name);
330326

331327
case file_typet::ELF_OBJECT:
332-
warning() << "Warning: Cannot read ELF library " << libname << eom;
328+
warning() << "Warning: Cannot read ELF library " << library_file_name
329+
<< eom;
333330
return warning_is_fatal;
334331

335332
default:

0 commit comments

Comments
 (0)