static void BackupEntry(IAbsoluteDirectoryPath workingDirectory, IAbsoluteDirectoryPath backupPath, IAbsoluteFilePath entry) { var backupDestination = entry.GetRelativePathFrom(workingDirectory).GetAbsolutePathFrom(backupPath); DeleteDestinationIfDirectory(backupDestination); DeleteParentFilesIfExists(backupDestination, backupPath); backupDestination.MakeSureParentPathExists(); entry.Move(backupDestination); }
private static void HandleFileBasedMod(IAbsoluteFilePath pak, IEnumerable <string> packages) { var pakBak = GetBackupFile(pak); if (packages.Contains(pak.FileNameWithoutExtension)) { if (!pak.Exists && pakBak.Exists) { pakBak.Move(pak); } } else { if (!pak.Exists) { return; } pakBak.DeleteIfExists(); pak.Move(pakBak); } }
private static void HandleFileBasedMod(IAbsoluteFilePath pak, IEnumerable<string> packages) { var pakBak = GetBackupFile(pak); if (packages.Contains(pak.FileNameWithoutExtension)) { if (!pak.Exists && pakBak.Exists) pakBak.Move(pak); } else { if (!pak.Exists) return; pakBak.DeleteIfExists(); pak.Move(pakBak); } }
public static void Move(this IAbsoluteFilePath src, IAbsoluteDirectoryPath destination, bool overwrite = true, bool checkMd5 = false) => src.Move(destination.GetChildFileWithName(src.FileName), overwrite, checkMd5);