Преглед изворни кода

Fixing an issue where layout file wasn't properly copied when creating a new project while another project was currently open

BearishSun пре 9 година
родитељ
комит
1f02116511

+ 2 - 2
Source/BansheeEditor/Include/BsEditorApplication.h

@@ -109,8 +109,8 @@ namespace bs
 		/**	Saves the provided widget layout at the default layout location. */
 		void saveWidgetLayout(const SPtr<EditorWidgetLayout>& layout);
 
-		/** Saves the default widget layout in the current project folder. */
-		void saveDefaultWidgetLayout();
+		/** Saves the default widget layout in the provided folder. */
+		void saveDefaultWidgetLayout(const Path& folder);
 
 		/** Loads the previously saved editor settings from the default location. Overwrites any current settings. */
 		void loadEditorSettings();

+ 5 - 5
Source/BansheeEditor/Source/BsEditorApplication.cpp

@@ -279,7 +279,7 @@ namespace bs
 		if (!FileSystem::exists(internalResourcesDir))
 			FileSystem::createDir(internalResourcesDir);
 
-		saveDefaultWidgetLayout();
+		saveDefaultWidgetLayout(path);
 	}
 
 	bool EditorApplication::isValidProjectPath(const Path& path)
@@ -303,7 +303,7 @@ namespace bs
 		layoutPath.append(WIDGET_LAYOUT_PATH);
 
 		if (!FileSystem::exists(layoutPath))
-			saveDefaultWidgetLayout();
+			saveDefaultWidgetLayout(getProjectPath());
 
 		if(FileSystem::exists(layoutPath))
 		{
@@ -323,9 +323,9 @@ namespace bs
 		fs.encode(layout.get());
 	}
 
-	void EditorApplication::saveDefaultWidgetLayout()
+	void EditorApplication::saveDefaultWidgetLayout(const Path& folder)
 	{
-		Path internalResourcesDir = Path::combine(mProjectPath, ProjectLibrary::INTERNAL_RESOURCES_DIR);
+		Path internalResourcesDir = Path::combine(folder, ProjectLibrary::INTERNAL_RESOURCES_DIR);
 
 		if (!FileSystem::exists(internalResourcesDir))
 			FileSystem::createDir(internalResourcesDir);
@@ -334,7 +334,7 @@ namespace bs
 
 		if (FileSystem::exists(defaultLayoutPath))
 		{
-			Path projectLayoutPath = Path::combine(mProjectPath, WIDGET_LAYOUT_PATH);
+			Path projectLayoutPath = Path::combine(folder, WIDGET_LAYOUT_PATH);
 			FileSystem::copy(defaultLayoutPath, projectLayoutPath, false);
 		}
 	}