private string GetFolder(string path, bool createIfNotExists)
        {
            if (path == null)
            {
                return(_directory.FullName);
            }
            string[] parts = StoragePath.GetParts(path);

            string fullPath = _directory.FullName;

            foreach (string part in parts)
            {
                fullPath = Path.Combine(fullPath, part);
            }

            if (!Directory.Exists(fullPath))
            {
                if (createIfNotExists)
                {
                    Directory.CreateDirectory(fullPath);
                }
                else
                {
                    return(null);
                }
            }

            return(fullPath);
        }
Exemplo n.º 2
0
        public BlobId(string fullId, BlobItemKind kind = BlobItemKind.File)
        {
            string path = StoragePath.Normalize(fullId);

            string[] parts = StoragePath.GetParts(path);

            Id         = parts.Last();
            FolderPath = parts.Length > 1
            ? StoragePath.Combine(parts.Take(parts.Length - 1))
            : StoragePath.PathStrSeparator;

            Kind = kind;
        }