2020-01-17 04:36:41 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-12-21 23:07:37 -04:00
|
|
|
using EpicGames.Core;
|
2021-06-09 12:54:42 -04:00
|
|
|
using UnrealBuildBase;
|
2020-01-17 04:36:41 -05:00
|
|
|
|
|
|
|
|
namespace UnrealBuildTool
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// General deploy support functions, exported for UAT
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DeployExports
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The max length of the deploy folder name.
|
|
|
|
|
/// </summary>
|
2021-06-07 12:42:02 -04:00
|
|
|
public const int DeployFolderMaxLength = 50;
|
2020-01-17 04:36:41 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
2021-06-07 12:42:02 -04:00
|
|
|
/// Gets the default deploy folder name on the format ShortProjectName-RootDirectoryName-UserName,
|
2020-01-17 04:36:41 -05:00
|
|
|
/// truncated to DeployFolderMaxLength characters, with dots '.' and whitespace ' ' stripped.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ShortProjectName">Project to deploy</param>
|
|
|
|
|
/// <returns>The default deploy folder name.</returns>
|
|
|
|
|
public static string GetDefaultDeployFolder(string ShortProjectName)
|
|
|
|
|
{
|
2021-06-07 12:42:02 -04:00
|
|
|
string DeployFolder = string.Format("{0}-{1}-{2}",
|
2021-06-03 17:09:09 -04:00
|
|
|
ShortProjectName,
|
2021-06-11 18:20:44 -04:00
|
|
|
Unreal.RootDirectory.GetDirectoryName(),
|
2021-06-08 15:52:56 -04:00
|
|
|
Environment.UserName);
|
2020-01-17 04:36:41 -05:00
|
|
|
|
|
|
|
|
DeployFolder = DeployFolder.Replace(" ", "");
|
|
|
|
|
DeployFolder = DeployFolder.Replace(".", "");
|
|
|
|
|
|
|
|
|
|
if (DeployFolder.Length > DeployFolderMaxLength)
|
|
|
|
|
{
|
|
|
|
|
DeployFolder = DeployFolder.Substring(0, DeployFolderMaxLength);
|
|
|
|
|
char[] CharsToTrim = {'-'};
|
|
|
|
|
DeployFolder = DeployFolder.Trim(CharsToTrim);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DeployFolder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|