protected VirtualFileProviderBase(string rootPath) { RootPath = rootPath; // Ensure RootPath ends with / if (RootPath != null) { if (RootPath == string.Empty) { throw new ArgumentException("rootPath"); } if (RootPath[RootPath.Length - 1] != VirtualFileSystem.DirectorySeparatorChar) { RootPath += VirtualFileSystem.DirectorySeparatorChar; } } VirtualFileSystem.RegisterProvider(this); }
/// <summary> /// Initializes a new instance of the <see cref="VirtualFileProviderBase"/> class. /// </summary> /// <param name="rootPath">The root path of this provider. That is the path all other paths will be relative to.</param> protected VirtualFileProviderBase(string rootPath) { RootPath = rootPath; // Ensure RootPath ends with / if (RootPath != null) { if (string.IsNullOrWhiteSpace(RootPath)) { throw new ArgumentException(nameof(rootPath)); } if (!RootPath.EndsWith(VirtualFileSystem.DirectorySeparatorChar)) { RootPath += VirtualFileSystem.DirectorySeparatorChar; } } VirtualFileSystem.RegisterProvider(this); }