Esempio n. 1
0
        protected override void PreExecute(string enlistmentRootPath, ITracer tracer = null)
        {
            this.Output.WriteLine("Validating repo for mount");
            this.CheckElevated();
            this.CheckGVFltRunning();

            if (string.IsNullOrWhiteSpace(enlistmentRootPath))
            {
                enlistmentRootPath = Environment.CurrentDirectory;
            }

            string enlistmentRoot = GVFSEnlistment.GetEnlistmentRoot(enlistmentRootPath);

            if (enlistmentRoot == null)
            {
                this.ReportErrorAndExit("Error: '{0}' is not a valid GVFS enlistment", enlistmentRootPath);
            }

            using (NamedPipeClient pipeClient = new NamedPipeClient(GVFSEnlistment.GetNamedPipeName(enlistmentRoot)))
            {
                if (pipeClient.Connect(500))
                {
                    this.ReportErrorAndExit("This repo is already mounted.  Try running 'gvfs status'.");
                }
            }

            string error;

            if (!RepoMetadata.CheckDiskLayoutVersion(Path.Combine(enlistmentRoot, GVFSConstants.DotGVFSPath), out error))
            {
                this.ReportErrorAndExit("Error: " + error);
            }
        }