示例#1
0
 /** Adds a file or folder that will be copied to Mac or iOS app bundle */
 public virtual void AddAdditionalBundleResource(UEBuildBundleResource Resource, bool bCheckForDuplicates = true)
 {
     if (bCheckForDuplicates == true)
     {
         if ( PublicAdditionalBundleResources.Contains( Resource ) )
         {
             return;
         }
     }
     PublicAdditionalBundleResources.Add( Resource );
 }
		FileItem CopyBundleResource(UEBuildBundleResource Resource, FileItem Executable)
		{
			Action CopyAction = new Action(ActionType.CreateAppBundle);
			CopyAction.WorkingDirectory = Path.GetFullPath(".");
			CopyAction.CommandPath = "/bin/sh";
			CopyAction.CommandDescription = "";

			string BundlePath = Executable.AbsolutePath.Substring(0, Executable.AbsolutePath.IndexOf(".app") + 4);
			string SourcePath = Path.Combine(CopyAction.WorkingDirectory, Resource.ResourcePath);
			string TargetPath = Path.Combine(BundlePath, "Contents", Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath));

			FileItem TargetItem;
			if(BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
			{
				TargetItem = FileItem.GetItemByPath(TargetPath);
			}
			else
			{
				TargetItem = FileItem.GetRemoteItemByPath(TargetPath, RemoteToolChainPlatform);
			}

			CopyAction.CommandArguments = string.Format("-c 'cp -f -R \"{0}\" \"{1}\"; touch -c \"{2}\"'", ConvertPath(SourcePath), Path.GetDirectoryName(TargetPath).Replace('\\', '/') + "/", TargetPath.Replace('\\', '/'));
			CopyAction.PrerequisiteItems.Add(Executable);
			CopyAction.ProducedItems.Add(TargetItem);
			CopyAction.bShouldOutputStatusDescription = Resource.bShouldLog;
			CopyAction.StatusDescription = string.Format("Copying {0} to app bundle", Path.GetFileName(Resource.ResourcePath));
			CopyAction.bCanExecuteRemotely = false;

			if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
			{
				CopyAction.ActionHandler = new Action.BlockingActionHandler(RPCUtilHelper.RPCActionHandler);
			}

			if (Directory.Exists(Resource.ResourcePath))
			{
				foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
				{
					QueueFileForBatchUpload(FileItem.GetItemByFullPath(Path.GetFullPath(ResourceFile)));
				}
			}
			else
			{
				QueueFileForBatchUpload(FileItem.GetItemByFullPath(SourcePath));
			}

			return TargetItem;
		}
        FileItem CopyBundleResource(UEBuildBundleResource Resource, FileItem Executable)
        {
            Action CopyAction = new Action(ActionType.CreateAppBundle);
            CopyAction.WorkingDirectory = Path.GetFullPath(".");
            CopyAction.CommandPath = "/bin/sh";
            CopyAction.CommandDescription = "";

            string BundlePath = Executable.AbsolutePath.Substring(0, Executable.AbsolutePath.IndexOf(".app") + 4);
            string SourcePath = Path.Combine(CopyAction.WorkingDirectory, Resource.ResourcePath);
            string TargetPath = Path.Combine(BundlePath, "Contents", Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath));

            FileItem TargetItem = LocalToRemoteFileItem(FileItem.GetItemByPath(TargetPath), false);

            CopyAction.CommandArguments = string.Format("-c 'cp -f -R \"{0}\" \"{1}\"; touch -c \"{2}\"'", SourcePath, Path.GetDirectoryName(TargetPath) + "/", TargetPath);
            CopyAction.PrerequisiteItems.Add(Executable);
            CopyAction.ProducedItems.Add(TargetItem);
            CopyAction.StatusDescription = string.Format("Copying {0} to app bundle", Path.GetFileName(Resource.ResourcePath));
            CopyAction.bCanExecuteRemotely = false;

            if (Directory.Exists(Resource.ResourcePath))
            {
                foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
                {
                    QueueFileForBatchUpload(FileItem.GetItemByFullPath(Path.GetFullPath(ResourceFile)));
                }
            }
            else
            {
                QueueFileForBatchUpload(FileItem.GetItemByFullPath(SourcePath));
            }

            return TargetItem;
        }