No longer add scripts to csproj

This commit is contained in:
Simon Lübeß
2025-08-11 22:09:00 +02:00
parent b94b2afc55
commit 4992511112
-28
View File
@@ -237,34 +237,6 @@ namespace GlitchyEditor
Log.EngineLogger.Error($"Failed to save script file to \"{path}\"."); Log.EngineLogger.Error($"Failed to save script file to \"{path}\".");
return; return;
} }
// Add to .csproj
String assetRelativePath = scope .();
Path.GetRelativePath(path, _currentProject.WorkspacePath, assetRelativePath);
String projectPath = scope .();
Editor.Instance.CurrentProject.PathInProject(projectPath, scope $"{Editor.Instance.CurrentProject.Name}.csproj");
String projectFile = scope .();
let loadProjectResult = File.ReadAllText(projectPath, projectFile, true);
if (loadProjectResult case .Err(let err))
{
Log.EngineLogger.Error($"Failed to open project file ({err}). Please add the file to the project manually.");
}
const String scriptFilesMarker = "<!-- Script Files -->";
int index = projectFile.IndexOf(scriptFilesMarker);
int lineEndIndex = projectFile.IndexOf('\n', index);
projectFile.Insert(lineEndIndex + 1, scope $" <Compile Include=\"{assetRelativePath}\" />\n");
let saveProjectResult = File.WriteAllText(projectPath, projectFile);
if (saveProjectResult case .Err(let err))
{
Log.EngineLogger.Error($"Failed to edit project file ({err}). Please add the file to the project manually.");
}
}, _editorIcons.File_CSharpScript)); }, _editorIcons.File_CSharpScript));
} }