Esempio n. 1
0
            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);
            }
Esempio n. 2
0
        public void Test_GetRelativePathWithError3()
        {
            IAbsoluteFilePath      filePathTo = @"C:\Dir1\File.txt".ToAbsoluteFilePath();
            IAbsoluteDirectoryPath absoluteDirectoryPathFrom = @"D:\Dir1".ToAbsoluteDirectoryPath();

            Assert.IsFalse(filePathTo.CanGetRelativePathFrom(absoluteDirectoryPathFrom));
            string failureReason;

            Assert.IsFalse(filePathTo.CanGetRelativePathFrom(absoluteDirectoryPathFrom, out failureReason));
            Assert.IsTrue(failureReason == @"Cannot compute relative path from 2 paths that are not on the same volume 
   PathFrom = ""D:\Dir1""
   PathTo   = ""C:\Dir1\File.txt""");
            filePathTo.GetRelativePathFrom(absoluteDirectoryPathFrom);
        }
 public Data(IAbsoluteFilePath realFile, IAbsoluteDirectoryPath basePath)
 {
     FileName = realFile.FileName;
     RealFileLocation = realFile.GetRelativePathFrom(basePath);
     RpfPlacement = RealFileLocation.ParentDirectoryPath;
 }
Esempio n. 4
0
 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);
 }