Browse Source

Added `defaultPath` preference.

Ross Hadden 9 years ago
parent
commit
a4a84ba5e8

+ 7 - 0
Script/AtomicEditor/editor/Preferences.ts

@@ -341,6 +341,7 @@ interface EditorBuildData {
 
 
 interface EditorFeatures {
 interface EditorFeatures {
     closePlayerLog: boolean;
     closePlayerLog: boolean;
+    defaultPath: string;
     defaultLanguage: string;
     defaultLanguage: string;
 }
 }
 
 
@@ -396,8 +397,14 @@ class PreferencesFormat {
             lastEditorBuildSHA: "Unversioned Build"
             lastEditorBuildSHA: "Unversioned Build"
         };
         };
 
 
+        var fileSystem = Atomic.getFileSystem();
+        var userDocuments = fileSystem.userDocumentsDir;
+        if (Atomic.platform == "MacOSX") userDocuments += "Documents/";
+        userDocuments += "AtomicProjects";
+
         this.editorFeatures = {
         this.editorFeatures = {
             closePlayerLog: true,
             closePlayerLog: true,
+            defaultPath: userDocuments,
             defaultLanguage: "JavaScript"
             defaultLanguage: "JavaScript"
         };
         };
 
 

+ 3 - 15
Script/AtomicEditor/ui/modal/CreateProject.ts

@@ -35,6 +35,7 @@ class CreateProject extends ModalWindow {
 
 
         this.projectPath = projectPath;
         this.projectPath = projectPath;
         this.projectTemplate = projectTemplate;
         this.projectTemplate = projectTemplate;
+        this.defaultPath = Preferences.getInstance().editorFeatures.defaultPath;
         this.defaultLanguage = Preferences.getInstance().editorFeatures.defaultLanguage;
         this.defaultLanguage = Preferences.getInstance().editorFeatures.defaultLanguage;
 
 
         this.init("Create Project", "AtomicEditor/editor/ui/createproject.tb.txt");
         this.init("Create Project", "AtomicEditor/editor/ui/createproject.tb.txt");
@@ -56,27 +57,13 @@ class CreateProject extends ModalWindow {
         else
         else
             this.image.image = projectTemplate.screenshot;
             this.image.image = projectTemplate.screenshot;
 
 
-        var fileSystem = Atomic.getFileSystem();
-
-        var userDocuments = fileSystem.userDocumentsDir;
-
-        if (Atomic.platform == "MacOSX") {
-
-            userDocuments += "Documents/AtomicProjects";
-
-        } else {
-
-            userDocuments += "AtomicProjects";
-
-        }
-
         // If we're specifying where to put the project (initially), then we are opening
         // If we're specifying where to put the project (initially), then we are opening
         // an example directly so use the same name
         // an example directly so use the same name
         if (projectPath) {
         if (projectPath) {
             this.projectNameField.text = projectTemplate.name;
             this.projectNameField.text = projectTemplate.name;
         }
         }
 
 
-        this.projectPathField.text = projectPath ? projectPath : userDocuments;
+        this.projectPathField.text = (projectPath) ? projectPath : this.defaultPath;
         this.populateLanguageSelectionList();
         this.populateLanguageSelectionList();
 
 
         // Need to manually set the focus so the contents get auto-selected
         // Need to manually set the focus so the contents get auto-selected
@@ -410,6 +397,7 @@ class CreateProject extends ModalWindow {
     // if we have specified a projectPath, the dest will not be the combination of path + name
     // if we have specified a projectPath, the dest will not be the combination of path + name
     projectPath: string;
     projectPath: string;
     projectTemplate: ProjectTemplates.ProjectTemplateDefinition;
     projectTemplate: ProjectTemplates.ProjectTemplateDefinition;
+    defaultPath: string;
     defaultLanguage: string;
     defaultLanguage: string;
 }
 }