Browse Source

as a stopgap measure, if a file extension is not provided for creating a new component or script, it will default to .js, but if one is provided, then it will use that.

Shaddock Heath 9 years ago
parent
commit
f5d1e6c8bf
1 changed files with 8 additions and 3 deletions
  1. 8 3
      Script/AtomicEditor/ui/modal/UIResourceOps.ts

+ 8 - 3
Script/AtomicEditor/ui/modal/UIResourceOps.ts

@@ -152,8 +152,10 @@ export class CreateComponent extends ModalWindow {
                 var componentName = this.nameField.text;
                 var componentName = this.nameField.text;
                 var outputFile = Atomic.addTrailingSlash(this.resourcePath) + componentName;
                 var outputFile = Atomic.addTrailingSlash(this.resourcePath) + componentName;
 
 
-                if (outputFile.indexOf(".js") == -1) outputFile += ".js";
-
+                // Check to see if we have a file extension.  If we don't then assume .js
+                if (outputFile.indexOf(".") == -1) {
+                    outputFile += ".js";
+                }
 
 
                 if (ResourceOps.CreateNewComponent(outputFile, componentName)) {
                 if (ResourceOps.CreateNewComponent(outputFile, componentName)) {
 
 
@@ -205,7 +207,10 @@ export class CreateScript extends ModalWindow {
                 var scriptName = this.nameField.text;
                 var scriptName = this.nameField.text;
                 var outputFile = Atomic.addTrailingSlash(this.resourcePath) + scriptName;
                 var outputFile = Atomic.addTrailingSlash(this.resourcePath) + scriptName;
 
 
-                if (outputFile.indexOf(".js") == -1) outputFile += ".js";
+                // Check to see if we have a file extension.  If we don't then assume .js
+                if (outputFile.indexOf(".") == -1) {
+                    outputFile += ".js";
+                }
 
 
 
 
                 if (ResourceOps.CreateNewScript(outputFile, scriptName)) {
                 if (ResourceOps.CreateNewScript(outputFile, scriptName)) {