Exemplo n.º 1
0
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node, GlobberSettings settings)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment, settings.Predicate);

            node.Accept(this, context);
            return(context.Results);
        }
Exemplo n.º 2
0
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment);

            node.Accept(this, context);
            return(context.Results);
        }
Exemplo n.º 3
0
        public IEnumerable <IFileSystemInfo> Walk(GlobNode node, Func <IDirectory, bool> predicate)
        {
            var context = new GlobVisitorContext(_fileSystem, _environment, predicate);

            node.Accept(this, context);
            return(context.Results);
        }
        public static void Validate(GlobPattern pattern, GlobNode node)
        {
            var previous = (GlobNode)null;
            var current  = node;

            while (current != null)
            {
                if (previous is RecursiveWildcardNode)
                {
                    if (current is ParentDirectoryNode)
                    {
                        throw new NotSupportedException("Visiting a parent that is a recursive wildcard is not supported.");
                    }
                }

                if (current is UncRootNode unc)
                {
                    if (string.IsNullOrWhiteSpace(unc.Server))
                    {
                        throw new CakeException($"The pattern '{pattern}' has no server part specified.");
                    }
                }

                previous = current;
                current  = current.Next;
            }
        }
Exemplo n.º 5
0
 private static GlobNode RewriteUncRoot(string pattern, GlobNode root)
 {
     if (root is UncRootNode unc && unc.Server == null)
     {
         var next = unc.Next;
         if (next == null)
         {
             throw new CakeException($"The pattern '{pattern}' has no server part specified.");
         }
         else if (next is PathNode path && path.IsIdentifier)
         {
             // Rewrite the root node.
             return(new UncRootNode(path.GetPath())
             {
                 Next = next.Next
             });
         }
Exemplo n.º 6
0
        public static void Validate(GlobNode node)
        {
            var previous = (GlobNode)null;
            var current  = node;

            while (current != null)
            {
                if (previous is RecursiveWildcardNode)
                {
                    if (current is ParentDirectoryNode)
                    {
                        throw new NotSupportedException("Visiting a parent that is a recursive wildcard is not supported.");
                    }
                }
                previous = current;
                current  = current.Next;
            }
        }