Chromium Code Reviews| Index: runtime/bin/extensions_linux.cc |
| diff --git a/runtime/bin/extensions_linux.cc b/runtime/bin/extensions_linux.cc |
| index df4df5895e30641075aff47ad42173554576a4ea..1a8a92c586aca0820d398c2cc69244f129970390 100644 |
| --- a/runtime/bin/extensions_linux.cc |
| +++ b/runtime/bin/extensions_linux.cc |
| @@ -5,11 +5,26 @@ |
| #include "bin/extensions.h" |
| #include <dlfcn.h> |
| -void* Extensions::LoadExtensionLibrary(const char* library_name) { |
| - const char* strings[4] = { "./lib", library_name, ".so", NULL }; |
| - char* library_path = Concatenate(strings); |
| - void* lib_handle = dlopen(library_path, RTLD_LAZY); |
| - free(library_path); |
| +void* Extensions::LoadExtensionLibrary(const char* library_path) { |
|
Mads Ager (google)
2012/03/14 10:29:47
The splitting up of the path into path and extensi
Bill Hesse
2012/03/14 17:15:04
Done.
|
| + const char* library_path_strings[2] = { library_path, NULL }; |
| + char* mutable_library_path = Concatenate(library_path_strings); |
|
Mads Ager (google)
2012/03/14 10:29:47
This is just a strdup?
Bill Hesse
2012/03/14 17:15:04
This is moved to the platform-independent code, an
|
| + |
| + char* last_path_separator = |
| + strrchr(mutable_library_path, '/'); |
| + if (last_path_separator == NULL) { |
| + free(mutable_library_path); |
| + return Dart_Error("Cannot find path separator in resolved extension name"); |
| + } |
| + char* extension_name = last_path_separator + 1; |
| + *last_path_separator = '\0'; |
| + |
| + const char* strings[5] = { mutable_library_path, "/lib", |
| + extension_name, ".so", NULL }; |
| + char* library_file_path = Concatenate(strings); |
| + fprintf(stderr, "%s\n", library_file_path); |
| + void* lib_handle = dlopen(library_file_path, RTLD_LAZY); |
| + free(library_file_path); |
| + free(mutable_library_path); |
| return lib_handle; |
| } |