From 621670824e76e7c1f7ca7128cffe902b008b4880 Mon Sep 17 00:00:00 2001 From: Seonghyun Kim Date: Thu, 29 Jun 2023 12:00:36 +0900 Subject: [PATCH] update shell Signed-off-by: Seonghyun Kim --- src/shell/Shell.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shell/Shell.cpp b/src/shell/Shell.cpp index ca783f36b..b5e7463ba 100644 --- a/src/shell/Shell.cpp +++ b/src/shell/Shell.cpp @@ -726,7 +726,14 @@ class ShellPlatform : public PlatformRef { virtual void didLoadModule(ContextRef* relatedContext, OptionalRef referrer, ScriptRef* loadedModule) override { std::string path; - if (referrer && loadedModule->src()->length() && loadedModule->src()->charAt(0) != '/') { + bool isAbs = false; + if (loadedModule->src()->length() && loadedModule->src()->charAt(0) == '/') { + isAbs = true; + } else if (loadedModule->src()->length() > 3 && loadedModule->src()->charAt(1) == ':' && loadedModule->src()->charAt(2) == '\\') { + isAbs = true; + } + + if (referrer && loadedModule->src()->length() && !isAbs) { path = absolutePath(referrer->src()->toStdUTF8String(), loadedModule->src()->toStdUTF8String()); } else { path = absolutePath(loadedModule->src()->toStdUTF8String());