summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs
blob: 6889ea715f5e574f710fd7500eb75687ec24bc4d (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);
            if (root.AddItemChecked(itemType, include.RelativeToPath(dir).Replace("/", "\\")))
                root.Save();
        }
    }
}