protected FileSystemObject(string path, string unmappedPath, FileSystemObjectSettings settings)
        {
            if (settings != null)
            {
                _backupEngine = settings.BackupEngine;
                _reporter = settings.Reporter;
                _backupModeMap = settings.BackupModeMap;
            }

            string container;
            string name;
            path.SplitIntoObjectAndContainer(out container, out name);
            MappedBasePath = container;
            unmappedPath.SplitIntoObjectAndContainer(out container, out name);
            UnmappedBasePath = container;
            Name = name;
            SetFileAttributes(path);
        }
 private void SetBaseObjects()
 {
     if (_baseObjectsSet)
         return;
     _baseObjectsSet = true;
     var forLaterCheck = new List<string>();
     var settings = new FileSystemObjectSettings(this)
     {
         Reporter = ErrorReporter,
         BackupModeMap = MakeMap(forLaterCheck),
     };
     foreach (var currentSourceLocation in GetCurrentSourceLocations())
         BaseObjects.Add(FileSystemObject.Create(
             MapPathForward(currentSourceLocation),
             currentSourceLocation,
             settings));
     BaseObjects.ForEach(x => x.IsMain = true);
     while (forLaterCheck.Count > 0)
     {
         var oldForLaterCheck = forLaterCheck;
         forLaterCheck = new List<string>();
         settings.BackupModeMap = MakeMap(forLaterCheck);
         foreach (var path in oldForLaterCheck)
             if (!Covered(path))
                 BaseObjects.Add(FileSystemObject.Create(MapPathForward(path), path, settings));
     }
     for (int i = 0; i < BaseObjects.Count; i++)
         BaseObjects[i].EntryNumber = i;
     RecalculateFileGuids();
 }
 public static FileSystemObject Create(string path, string unmappedPath, FileSystemObjectSettings settings = null)
 {
     switch (GetType(path))
     {
         case FileSystemObjectType.Directory:
             return new DirectoryFso(path, unmappedPath, settings);
         case FileSystemObjectType.RegularFile:
             return new RegularFileFso(path, unmappedPath, settings);
         case FileSystemObjectType.DirectorySymlink:
             return new DirectorySymlinkFso(path, unmappedPath, settings);
         case FileSystemObjectType.Junction:
             return new JunctionFso(path, unmappedPath, settings);
         case FileSystemObjectType.FileSymlink:
             return new FileSymlinkFso(path, unmappedPath, settings);
         case FileSystemObjectType.FileReparsePoint:
             return new FileReparsePointFso(path, unmappedPath, settings);
         case FileSystemObjectType.FileHardlink:
             return new FileHardlinkFso(path, unmappedPath, settings);
         default:
             throw new ArgumentOutOfRangeException();
     }
 }