AccessProviderSample.AccessDBProvider.NormalizeRelativePath C# (CSharp) Method

NormalizeRelativePath() protected method

Normalizes the path that was passed in and returns the normalized path as a relative path to the basePath that was passed.
protected NormalizeRelativePath ( string path, string basepath ) : string
path string /// A fully qualified provider specific path to an item. The item /// should exist or the provider should write out an error. ///
basepath string /// The path that the return value should be relative to. ///
return string
        protected override string NormalizeRelativePath(string path,
            string basepath)
        {
            // Normalize the paths first
            string normalPath = NormalizePath(path);
            normalPath = RemoveDriveFromPath(normalPath);
            string normalBasePath = NormalizePath(basepath);
            normalBasePath = RemoveDriveFromPath(normalBasePath);

            if (String.IsNullOrEmpty(normalBasePath))
            {
                return normalPath;
            }
            else
            {
                if (!normalPath.Contains(normalBasePath))
                {
                    return null;
                }

                return normalPath.Substring(normalBasePath.Length + pathSeparator.Length);
            }
        }