Beispiel #1
0
        private string ResolveTenantDataDirectory(string filesystemLocation, string filesystemName, out string documentDataDir)
        {
            if (Path.IsPathRooted(filesystemLocation))
            {
                documentDataDir = filesystemLocation;
                return(documentDataDir);
            }

            var baseDataPath = Path.GetDirectoryName(this.FileSystemsLandlord.SystemConfiguration.FileSystem.DataDirectory);

            if (baseDataPath == null)
            {
                throw new InvalidOperationException("Could not find root data path");
            }

            if (string.IsNullOrWhiteSpace(filesystemLocation))
            {
                documentDataDir = Path.Combine("~\\FileSystems", filesystemName);
                return(IOExtensions.ToFullPath(documentDataDir, baseDataPath));
            }

            documentDataDir = filesystemLocation;

            if (!documentDataDir.StartsWith("~/") && !documentDataDir.StartsWith(@"~\"))
            {
                documentDataDir = "~\\" + documentDataDir.TrimStart(new[] { '/', '\\' });
            }
            else if (documentDataDir.StartsWith("~/") || documentDataDir.StartsWith(@"~\"))
            {
                documentDataDir = "~\\" + documentDataDir.Substring(2);
            }

            return(IOExtensions.ToFullPath(documentDataDir, baseDataPath));
        }