This commit is contained in:
max 2024-07-24 21:40:10 +02:00
parent b9f5a4c56b
commit b4c3b5ed18
2 changed files with 24 additions and 24 deletions

View File

@ -7,9 +7,9 @@ internal static class EditorProject
internal static Compiler.Project Project { get; private set; } = null;
internal static string ProjectFilePath { get; private set; } = string.Empty;
internal static string ProjectSolutionFilePath { get; private set; } = string.Empty;
internal static string ProjectPath { get; private set; } = string.Empty;
internal static string ProjectContentPath { get; private set; } = string.Empty;
internal static string ProjectTempPath { get; private set; } = string.Empty;
internal static string ProjectDirectory { get; private set; } = string.Empty;
internal static string ProjectContentDirectory { get; private set; } = string.Empty;
internal static string ProjectTempDirectory { get; private set; } = string.Empty;
internal static bool Create(string projectFilePath, string projectName)
{
@ -26,20 +26,20 @@ internal static bool Create(string projectFilePath, string projectName)
return true;
}
internal static bool Open(string path)
internal static bool Open(string projectFilePath)
{
Close();
if(!Compiler.Project.Open(path, out Compiler.Project project))
if(!Compiler.Project.Open(projectFilePath, out Compiler.Project project))
{
return false;
}
Project = project;
ProjectFilePath = path;
ProjectPath = Path.GetDirectoryName(path);
ProjectFilePath = projectFilePath;
ProjectDirectory = Path.GetDirectoryName(projectFilePath);
string projectSolutionFilePath = Path.Combine(ProjectPath, Project.Name + Compiler.Generator.SolutionExtensionName);
string projectSolutionFilePath = Path.Combine(ProjectDirectory, Project.Name + Compiler.Generator.SolutionExtensionName);
if (File.Exists(projectSolutionFilePath))
{
ProjectSolutionFilePath = projectSolutionFilePath;
@ -58,9 +58,9 @@ internal static void Close()
Project = null;
ProjectFilePath = string.Empty;
ProjectSolutionFilePath = string.Empty;
ProjectPath = string.Empty;
ProjectContentPath = string.Empty;
ProjectTempPath = string.Empty;
ProjectDirectory = string.Empty;
ProjectContentDirectory = string.Empty;
ProjectTempDirectory = string.Empty;
}
internal static bool Save()
@ -90,24 +90,24 @@ internal static void GenerateSolution()
return;
}
Nerfed.Compiler.Generator.GenerateSolution(ProjectPath, Project, out string solutionFilePath);
Nerfed.Compiler.Generator.GenerateSolution(ProjectDirectory, Project, out string solutionFilePath);
ProjectSolutionFilePath = solutionFilePath;
}
private static void SetupDefaultFolders()
{
if (Project == null || ProjectPath == null)
if (Project == null || ProjectDirectory == null)
{
return;
}
string contentPath = Path.Combine(ProjectPath, "Content");
string contentPath = Path.Combine(ProjectDirectory, "Content");
if (!Directory.Exists(contentPath))
{
Directory.CreateDirectory(contentPath);
}
ProjectContentPath = contentPath;
string scriptsPath = Path.Combine(ProjectContentPath, "Scripts");
ProjectContentDirectory = contentPath;
string scriptsPath = Path.Combine(ProjectContentDirectory, "Scripts");
if (!Directory.Exists(scriptsPath))
{
Directory.CreateDirectory(scriptsPath);
@ -125,11 +125,11 @@ private static void SetupDefaultFolders()
Compiler.AssemblyDefinition.Create(gameplayRuntimePath, "Gameplay", out Compiler.AssemblyDefinition project);
}
string tempPath = Path.Combine(ProjectPath, "Temp");
string tempPath = Path.Combine(ProjectDirectory, "Temp");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(tempPath);
}
ProjectTempPath = tempPath;
ProjectTempDirectory = tempPath;
}
}

View File

@ -4,7 +4,7 @@ namespace Nerfed.Editor.Project
{
internal static class ProjectGui
{
private static string projectPath = string.Empty;
private static string projectDirectory = string.Empty;
private static string projectName = string.Empty;
private static string projectFilePath = string.Empty;
@ -13,10 +13,10 @@ internal static void OnGui()
ImGui.Begin("Project");
ImGui.BeginGroup();
ImGui.InputText("Project Path", ref projectPath, 512);
ImGui.InputText("Project Directory", ref projectDirectory, 512);
ImGui.InputText("Project Name", ref projectName, 512);
string newProjectFilePath = Path.Combine(projectPath, ".project");
string newProjectFilePath = Path.Combine(projectDirectory, ".project");
ImGui.Text(newProjectFilePath);
if (ImGui.Button("Create Project"))
@ -39,9 +39,9 @@ internal static void OnGui()
ImGui.Text(EditorProject.Project.Name);
ImGui.Text(EditorProject.ProjectFilePath);
ImGui.Text(EditorProject.ProjectSolutionFilePath);
ImGui.Text(EditorProject.ProjectPath);
ImGui.Text(EditorProject.ProjectContentPath);
ImGui.Text(EditorProject.ProjectTempPath);
ImGui.Text(EditorProject.ProjectDirectory);
ImGui.Text(EditorProject.ProjectContentDirectory);
ImGui.Text(EditorProject.ProjectTempDirectory);
}
else
{