Ver Fonte

Bugfix: Check if solution file exists and rebuild if necessary

BearishSun há 6 anos atrás
pai
commit
2abd6a0378

+ 2 - 3
Source/EditorCore/CodeEditor/BsCodeEditor.h

@@ -82,10 +82,9 @@ namespace bs
 		void syncSolution(const String& gameProjectName, const CodeProjectReference& engineAssemblyRef, 
 			const CodeProjectReference& editorAssemblyRef) const;
 
-	private:
 		/**	Returns the absolute path at which the external editor solution file should be stored. */
 		Path getSolutionPath() const;
-
+	private:
 		CodeEditor* mActiveEditor;
 		CodeEditorType mActiveEditorType;
 		Map<CodeEditorType, CodeEditorFactory*> mFactoryPerEditor;
@@ -106,7 +105,7 @@ namespace bs
 	class BS_ED_EXPORT CodeEditor
 	{
 	public:
-		virtual ~CodeEditor() { }
+		virtual ~CodeEditor() = default;
 
 		/** 
 		 * @copydoc CodeEditorManager::openFile 

+ 13 - 1
Source/EditorManaged/Script/CodeEditor.cs

@@ -1,6 +1,7 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 using System;
+using System.IO;
 using System.Runtime.CompilerServices;
 using bs;
 
@@ -68,6 +69,14 @@ namespace bs.Editor
             get { return Internal_GetAvailableEditors(); }
         }
 
+        /// <summary>
+        /// Returns the absolute path at which the code editor solution is stored at.
+        /// </summary>
+        public static string SolutionPath
+        {
+            get { return Internal_GetSolutionPath(); }
+        }
+
         /// <summary>
         /// Opens a script file in the currently active code editor.
         /// </summary>
@@ -75,7 +84,7 @@ namespace bs.Editor
         /// <param name="line">Line in the file to focus the editor on.</param>
         public static void OpenFile(string path, int line)
         {
-            if (IsSolutionDirty)
+            if (IsSolutionDirty || !File.Exists(SolutionPath))
                 SyncSolution();
 
             Internal_OpenFile(path, line);
@@ -112,6 +121,9 @@ namespace bs.Editor
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         internal static extern void Internal_SyncSolution();
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        internal static extern string Internal_GetSolutionPath();
     }
 
     /** @} */

+ 8 - 0
Source/EditorScript/Wrappers/BsScriptCodeEditor.cpp

@@ -26,6 +26,7 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_GetAvailableEditors", (void*)&ScriptCodeEditor::internal_GetAvailableEditors);
 		metaData.scriptClass->addInternalCall("Internal_OpenFile", (void*)&ScriptCodeEditor::internal_OpenFile);
 		metaData.scriptClass->addInternalCall("Internal_SyncSolution", (void*)&ScriptCodeEditor::internal_SyncSolution);
+		metaData.scriptClass->addInternalCall("Internal_GetSolutionPath", (void*)&ScriptCodeEditor::internal_GetSolutionPath);
 	}
 
 	CodeEditorType ScriptCodeEditor::internal_GetActiveEditor()
@@ -66,4 +67,11 @@ namespace bs
 			CodeProjectReference { ENGINE_ASSEMBLY, EngineScriptLibrary::instance().getEngineAssemblyPath() },
 			CodeProjectReference { EDITOR_ASSEMBLY, EditorScriptLibrary::instance().getEditorAssemblyPath() });
 	}
+
+	MonoString* ScriptCodeEditor::internal_GetSolutionPath()
+	{
+		return MonoUtil::stringToMono(CodeEditorManager::instance().getSolutionPath().toString());
+		
+	}
+
 }

+ 1 - 0
Source/EditorScript/Wrappers/BsScriptCodeEditor.h

@@ -28,6 +28,7 @@ namespace bs
 		static MonoArray* internal_GetAvailableEditors();
 		static void internal_OpenFile(MonoString* path, UINT32 line);
 		static void internal_SyncSolution();
+		static MonoString* internal_GetSolutionPath();
 	};
 
 	/** @} */