Browse Source

Fix for when source maps are used. The extension loader was trying to load the maps as new extensions.

Shaddock Heath 8 years ago
parent
commit
400a9f8aaa

+ 6 - 2
Script/AtomicEditor/hostExtensions/coreExtensions/ProjectBasedExtensionLoader.ts

@@ -75,7 +75,10 @@ export default class ProjectBasedExtensionLoader extends Atomic.ScriptObject imp
                         if (Atomic.fileSystem.fileExists(path)) {
                             let include = new Atomic.File(path, Atomic.FileMode.FILE_READ);
                             try {
-                                return include.readText();
+                                // add a newline to handle situations where sourcemaps are used.  Duktape
+                                // doens't like not having a trailing newline and the sourcemap process doesn't
+                                // add one.
+                                return include.readText() + "\n";
                             } finally {
                                 include.close();
                             }
@@ -104,10 +107,11 @@ export default class ProjectBasedExtensionLoader extends Atomic.ScriptObject imp
             let editorScriptsPath = Atomic.addTrailingSlash(system.project.resourcePath) + "EditorData/";
             if (fileSystem.dirExists(editorScriptsPath)) {
                 let filenames = fileSystem.scanDir(editorScriptsPath, "*.js", Atomic.SCAN_FILES, true);
+                const patternToMatch = /\.plugin.js$/;
                 filenames.forEach((filename) => {
                     // Filtered search in Atomic doesn't due true wildcarding, only handles extension filters
                     // in the future this may be better handled with some kind of manifest file
-                    if (filename.toLowerCase().lastIndexOf(".plugin.js") >= 0) {
+                    if (filename.search(/\.plugin.js$/i) != -1) {
                         var extensionPath = editorScriptsPath + filename;
                         extensionPath = extensionPath.substring(0, extensionPath.length - 3);