From 7ac8d7de2222cd37671d7c25f363dfa2207d5ee9 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 11 Jun 2022 13:40:54 +0200 Subject: Added support to load different libs with same name from different folders (for #299) --- src/librarian/library.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/librarian/library.c b/src/librarian/library.c index e1360a8b..0ef65a3a 100755 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -363,7 +363,7 @@ library_t *NewLibrary(const char* path, box64context_t* context) int essential = isEssentialLib(lib->name); if(!notwrapped && box64_prefer_emulated && !essential) notwrapped = 1; - int precise = (!box64_prefer_wrapped && !essential && path && path[0]=='/')?1:0; + int precise = (!box64_prefer_wrapped && !essential && path && strchr(path, '/'))?1:0; if(!notwrapped && precise && strstr(path, "libtcmalloc_minimal.so")) precise = 0; // allow native version for tcmalloc_minimum // check if name is libSDL_sound-1.0.so.1 but with SDL2 loaded, then try emulated first... @@ -553,9 +553,14 @@ int IsSameLib(library_t* lib, const char* path) if(!lib) return 0; char* name = Path2Name(path); - if(strcmp(name, lib->name)==0) - ret=1; - else { + if((!strchr(path, '/') || lib->type==0)) { + if(strcmp(name, lib->name)==0) + ret=1; + } else { + if(!strcmp(path, lib->path)) + ret=1; + } + if(!ret) { int n = NbDot(name); if(n>=0 && nnbdot) if(strncmp(name, lib->name, strlen(name))==0) -- cgit 1.4.1