aboutsummaryrefslogtreecommitdiff
path: root/Build/Scripts/EnablePluginByDefault.cs
blob: 64c25c101ad3fcdccdfb4fc530951d34e3920a46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Epic Games, Inc. All Rights Reserved.

using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Reflection;
using AutomationTool;
using UnrealBuildTool;
using Tools.DotNETCommon;

using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Diagnostics;

namespace SimpleUGC.Automation
{
	[Help("Sets the EnabledByDefault flag for a plugin to true")]
	public class EnablePluginByDefault : BuildCommand
	{
		public override void ExecuteBuild()
		{
			string FileName = ParseParamValue("FileName", null);
			if(FileName == null)
			{
				throw new AutomationException("Missing -FileName=... argument");
			}

			CommandUtils.SetFileAttributes(FileName, ReadOnly: false);
			
			PluginDescriptor Plugin = PluginDescriptor.FromFile(new FileReference(FileName));
			Plugin.bEnabledByDefault = true;
			Plugin.Save(FileName);
		}
	}
}