| Index: runtime/bin/loader.cc
|
| diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
|
| index 122e851a302bb167d097aadd5480be963028b998..4d35728d228eeeffe234ec83ad1fd1bf6a310ac7 100644
|
| --- a/runtime/bin/loader.cc
|
| +++ b/runtime/bin/loader.cc
|
| @@ -8,6 +8,7 @@
|
| #include "bin/builtin.h"
|
| #include "bin/dartutils.h"
|
| #include "bin/extensions.h"
|
| +#include "bin/file.h"
|
| #include "bin/lockers.h"
|
| #include "bin/utils.h"
|
|
|
| @@ -261,12 +262,10 @@ static bool LibraryHandleError(Dart_Handle library, Dart_Handle error) {
|
| }
|
|
|
|
|
| -static bool IsWindowsHost() {
|
| -#if defined(TARGET_OS_WINDOWS)
|
| - return true;
|
| -#else // defined(TARGET_OS_WINDOWS)
|
| - return false;
|
| -#endif // defined(TARGET_OS_WINDOWS)
|
| +static bool PathContainsSeparator(const char* path) {
|
| + return (strchr(path, '/') != NULL) ||
|
| + ((strncmp(File::PathSeparator(), "/", 1) != 0) &&
|
| + (strstr(path, File::PathSeparator()) != NULL));
|
| }
|
|
|
|
|
| @@ -300,7 +299,6 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) {
|
| return false;
|
| }
|
|
|
| -
|
| if (result->tag == _Dart_kImportExtension) {
|
| ASSERT(library_uri != Dart_Null());
|
| Dart_Handle library = Dart_LookupLibrary(library_uri);
|
| @@ -320,10 +318,10 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) {
|
| lib_path = lib_uri;
|
| }
|
| const char* extension_path = DartUtils::RemoveScheme(extension_uri);
|
| - if (strchr(extension_path, '/') != NULL ||
|
| - (IsWindowsHost() && strchr(extension_path, '\\') != NULL)) {
|
| + if (!File::IsAbsolutePath(extension_path) &&
|
| + PathContainsSeparator(extension_path)) {
|
| loader->error_ = DartUtils::NewError(
|
| - "Relative paths for dart extensions are not supported: '%s'",
|
| + "Native extension path must be absolute, or simply the file name: %s",
|
| extension_path);
|
| return false;
|
| }
|
|
|