Browse Source

Fix require issue when component script is in root resource folder

JoshEngebretson 10 years ago
parent
commit
b2b3a231e6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Source/AtomicJS/Javascript/JSComponentFile.cpp

+ 4 - 1
Source/AtomicJS/Javascript/JSComponentFile.cpp

@@ -101,7 +101,10 @@ bool JSComponentFile::PushModule()
     String pathName, fileName, ext;
     SplitPath(path, pathName, fileName, ext);
 
-    pathName += "/" + fileName;
+	if (path.Contains('/') || path.Contains('\\'))
+		pathName += "/" + fileName;
+	else
+		pathName = fileName;
 
     duk_get_global_string(ctx, "require");
     duk_push_string(ctx, pathName.CString());