예제 #1
0
        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);
        }
예제 #2
0
        /// <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);
        }