Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check a .csproj exists before trying to edit it #56101

Merged
merged 1 commit into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private bool CreateProjectSolution()
{
Guid = guid,
PathRelativeToSolution = name + ".csproj",
Configs = new List<string> {"Debug", "ExportDebug", "ExportRelease"}
Configs = new List<string> { "Debug", "ExportDebug", "ExportRelease" }
};

solution.AddNewProject(name, projectInfo);
Expand Down Expand Up @@ -164,20 +164,28 @@ private void _FileSystemDockFileMoved(string file, string newFile)
private void _FileSystemDockFileRemoved(string file)
{
if (Path.GetExtension(file) == Internal.CSharpLanguageExtension)
{
ProjectUtils.RemoveItemFromProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile",
ProjectSettings.GlobalizePath(file));
}
}

private void _FileSystemDockFolderMoved(string oldFolder, string newFolder)
{
ProjectUtils.RenameItemsToNewFolderInProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile",
ProjectSettings.GlobalizePath(oldFolder), ProjectSettings.GlobalizePath(newFolder));
if (File.Exists(GodotSharpDirs.ProjectCsProjPath))
{
ProjectUtils.RenameItemsToNewFolderInProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile",
ProjectSettings.GlobalizePath(oldFolder), ProjectSettings.GlobalizePath(newFolder));
}
}

private void _FileSystemDockFolderRemoved(string oldFolder)
{
ProjectUtils.RemoveItemsInFolderFromProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile",
ProjectSettings.GlobalizePath(oldFolder));
if (File.Exists(GodotSharpDirs.ProjectCsProjPath))
{
ProjectUtils.RemoveItemsInFolderFromProjectChecked(GodotSharpDirs.ProjectCsProjPath, "Compile",
ProjectSettings.GlobalizePath(oldFolder));
}
}

public override void _Ready()
Expand Down Expand Up @@ -431,7 +439,7 @@ public override void EnablePlugin()
MSBuildPanel = new MSBuildPanel();
_bottomPanelBtn = AddControlToBottomPanel(MSBuildPanel, "MSBuild".TTR());

AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"});
AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" });

_menuPopup = new PopupMenu();
_menuPopup.Hide();
Expand Down