Exemplo n.º 1
0
Arquivo: Ls.cs Projeto: rjshaver/core
        async Task <List <VirtualNode> > resolveParameters()
        {
            List <VirtualNode> nodes = new List <VirtualNode> ();

            // if there are command line parameters, resolve them
            if (parameters.Count > 0)
            {
                foreach (string p in parameters)
                {
                    try {
                        Path        resolvedPath = FileSystemSubsystems.ResolveRelativePath(env) (p);
                        VirtualNode node         = FileSystemSubsystems.Node(resolvedPath);
                        nodes.Add(node);
                    } catch (VirtualIOException ex) {
                        Log.Error(ex);
                        await Output.WriteLineAsync(ex.Message);
                    }
                }
            }
            // otherwise, use the current working directory
            else
            {
                nodes.Add(env.WorkingDirectory);
            }

            return(nodes);
        }
Exemplo n.º 2
0
        protected override Task ExecuteInternalAsync()
        {
            VirtualDirectory node =
                parameters.Count >= 1
                                ? FileSystemSubsystems.Directory(FileSystemSubsystems.ResolveRelativePath(env) (parameters [0]))
                                : env.HomeDirectory;

            Log.Debug("change directory to: ", node);

            node.Validate(throwExceptions: true);

            env.WorkingDirectory = node;

            return(TaskHelper.Completed);
        }