// Copies a directory and all it's subdirectories // From https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) { // Get the subdirectories for the specified directory. DirectoryInfo dir = new DirectoryInfo(sourceDirName); if (!dir.Exists) { throw new DirectoryNotFoundException( "Source directory does not exist or could not be found: " + sourceDirName); } DirectoryInfo[] dirs = dir.GetDirectories(); // If the destination directory doesn't exist, create it. Directory.CreateDirectory(destDirName); // Get the files in the directory and copy them to the new location. FileInfo[] files = dir.GetFiles(); foreach (FileInfo file in files) { string tempPath = Path.Combine(destDirName, file.Name); file.CopyTo(tempPath, true); } // If copying subdirectories, copy them and their contents to new location. if (copySubDirs) { foreach (DirectoryInfo subdir in dirs) { string tempPath = Path.Combine(destDirName, subdir.Name); Filesystem.DirectoryCopy(subdir.FullName, tempPath, copySubDirs); } } }
static void CompressPlugin(UE4InstallInfo Install, string PluginDirectory, string PluginVersion) { Filesystem.SafeCreateDirectory("tmp"); Filesystem.DirectoryCopy(PluginDirectory, "tmp/modio", true); ZipFile.CreateFromDirectory("tmp/modio", string.Format("PluginStaging_ALL/modio-{0}-{1}.zip", PluginVersion, Install.GetCleanAppName()) ); Directory.Delete("tmp", true); // We have no need of the plugin directory after this Directory.Delete(PluginDirectory, true); }
/// <summary> /// Platform specific code depending on what platform we currently are running /// </summary> static void PlatformSetup(UE4InstallInfo Install) { // @todo: Next instance we need to check for the platform, make a platform object that we can use to // move the platform specific code in a specific object // On windows, we compile linux so need to ensure that the environment is properly setup if (Platform.IsWindows()) { // Ensure that we are using the correct clang version for each engine install Environment.SetEnvironmentVariable("LINUX_MULTIARCH_ROOT", Install.Metadata.ClangInstallPath, EnvironmentVariableTarget.Process); } // On OS X, we require different Xcode-versions to compile all versions. Switch X-code version depending // on the current UE4 version if (Platform.IsMacOS()) { Filesystem.SafeDeleteDirectory("/Applications/Xcode.app", true); Filesystem.CreateSymbolicLink(Install.Metadata.XCodeInstallPath, "/Applications/Xcode.app"); } }
/** Add the config to the plugin as we has redistrubuted this config directory with each plugin */ static void AddConfigFiles(string PluginDirectory) { Filesystem.DirectoryCopy(@"../Config/", PluginDirectory + @"/Config/", true); }
/** After the plugin has been built, cleanup the output directory so we only have the desired files */ static void CleanupInstallDirectory(string PluginDirectory) { Filesystem.SafeDeleteDirectory(PluginDirectory + "/Binaries", true); Filesystem.SafeDeleteDirectory(PluginDirectory + "/img", true); Filesystem.SafeDeleteDirectory(PluginDirectory + "/Intermediate", true); }
/** Cleanup the output directory so that we start with a clean output directory */ static void SetupClean() { Filesystem.SafeDeleteDirectory(Environment.CurrentDirectory + "/PluginStaging_ALL", true); }