protected VirtualFolderInfo GetFolderInfoInternal(string virtualFolderPath, bool mustExist, out string absolutePath)
        {
            try
            {
                //make sure we operate on absolute paths
                absolutePath = PathUtil.GetAbsolutePath(virtualFolderPath ?? "", RootDirectory);

                if (IsRootPath(absolutePath))
                {
                    return(GetFileSystemRoot());
                }

                var di = new DirectoryInfo(absolutePath);
                VirtualFolderInfo folderInfo = di.CreateFolderResourceInfo();

                //convert to relative paths if required (also prevents qualified paths in validation exceptions)
                if (UseRelativePaths)
                {
                    folderInfo.MakePathsRelativeTo(RootDirectory);
                }

                //make sure the user is allowed to access the resource
                ValidateResourceAccess(folderInfo);

                //verify folder exists on FS
                if (mustExist)
                {
                    folderInfo.VerifyDirectoryExists(RootDirectory);
                }

                return(folderInfo);
            }
            catch (VfsException)
            {
                //just bubble internal exceptions
                throw;
            }
            catch (Exception e)
            {
                VfsLog.Debug(e, "Could not create directory based on path '{0}' with root '{1}'", virtualFolderPath,
                             RootDirectory);
                throw new ResourceAccessException("Invalid path submitted: " + virtualFolderPath);
            }
        }
        /// <summary>
        /// Resolves the parent folder for a virtual resource.
        /// </summary>
        /// <param name="child">The child file or folder.</param>
        /// <returns>The parent folder info.</returns>
        private VirtualFolderInfo GetParentInternal(VirtualResourceInfo child)
        {
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }

            string path = PathUtil.GetAbsolutePath(child.FullName, RootDirectory);

            if (IsRootPath(path))
            {
                //only log the request for the root's parent - do not include that
                //info in an exception in case we're hiding path information
                string msg = "Error while requesting parent of resource {0} - the folder itself already is the root.";
                VfsLog.Error(msg, child.FullName);

                //create exception with a relative path, if required
                string exceptionPath = UseRelativePaths ? PathUtil.RelativeRootPrefix : child.FullName;
                msg = String.Format(msg, exceptionPath);
                throw new ResourceAccessException(msg);
            }

            //make sure the processed directory exists
            VirtualFolderInfo folder = child as VirtualFolderInfo;

            if (folder != null)
            {
                folder.VerifyDirectoryExists(RootDirectory);
            }
            else
            {
                VirtualFileInfo file = (VirtualFileInfo)child;
                file.VerifyFileExists(RootDirectory);
            }

            //get the path of the parent (returned value may be null!)
            string parentPath = Path.GetDirectoryName(path);

            //get folder info
            return(GetFolderInfo(parentPath));
        }