/// <inheritdoc /> public override string ConvertToSnapshotPath(string localPath) { // For Windows, ensure we don't store paths with UNC prefix localPath = SystemIOWindows.StripUNCPrefix(localPath); if (!Path.IsPathRooted(localPath)) { throw new InvalidOperationException(); } var root = SystemIO.IO_WIN.GetPathRoot(localPath); var volumePath = _vssBackupComponents.GetVolumeFromCache(root); // Note that using a simple Path.Combine() for the following code // can result in invalid snapshot paths; e.g., if localPath is // @"C:\", mappedPath would not have the required trailing // directory separator. var subPath = localPath.Substring(root.Length); if (!subPath.StartsWith(Util.DirectorySeparatorString, StringComparison.Ordinal)) { volumePath = Util.AppendDirSeparator(volumePath, Util.DirectorySeparatorString); } var mappedPath = volumePath + subPath; return(mappedPath); }
/// <summary> /// Lists all files in the given folder /// </summary> /// <returns>All folders found in the folder</returns> /// <param name='localFolderPath'>The folder to examinate</param> protected override string[] ListFiles(string localFolderPath) { string[] tmp = SystemIO.IO_WIN.GetFiles(localFolderPath); string[] res = new string[tmp.Length]; for (int i = 0; i < tmp.Length; i++) { res[i] = SystemIOWindows.StripUNCPrefix(tmp[i]); } return(res); }
/// <summary> /// Lists all folders in the given folder /// </summary> /// <returns>All folders found in the folder</returns> /// <param name='folder'>The folder to examinate</param> protected override string[] ListFolders(string folder) { if (!SystemIOWindows.IsPathTooLong(folder)) { try { return(base.ListFolders(folder)); } catch (System.IO.PathTooLongException) { } } string[] tmp = Directory.GetDirectories(SystemIOWindows.PrefixWithUNC(folder)); string[] res = new string[tmp.Length]; for (int i = 0; i < tmp.Length; i++) { res[i] = SystemIOWindows.StripUNCPrefix(tmp[i]); } return(res); }
/// <inheritdoc /> public override string ConvertToSnapshotPath(string localPath) { // For Windows, ensure we don't store paths with UNC prefix return(SystemIOWindows.StripUNCPrefix(localPath)); }