Skip to content

Commit

Permalink
Merge pull request #56101 from raulsntos/fix-56095
Browse files Browse the repository at this point in the history
Check a `.csproj` exists before trying to edit it
  • Loading branch information
akien-mga authored Dec 20, 2021
2 parents 17b3173 + cf98ff2 commit 84d1cea
Showing 1 changed file with 14 additions and 6 deletions.
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

0 comments on commit 84d1cea

Please sign in to comment.