summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs
blob: a50b4fb06469bc0c5d4393492f862a2f046caf19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;
using System.IO;
using Microsoft.Build.Construction;

namespace GodotSharpTools.Project
{
    public static class ProjectUtils
    {
        public static void AddItemToProjectChecked(string projectPath, string itemType, string include)
        {
            var dir = Directory.GetParent(projectPath).FullName;
            var root = ProjectRootElement.Open(projectPath);
            root.AddItemChecked(itemType, include.RelativeToPath(dir).Replace("/", "\\"));
            root.Save();
        }
    }
}