forked from microsoft/VFSForGit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGVFSPlatform.cs
More file actions
127 lines (102 loc) · 4.95 KB
/
GVFSPlatform.cs
File metadata and controls
127 lines (102 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using GVFS.Common.FileSystem;
using GVFS.Common.Git;
using GVFS.Common.Tracing;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
namespace GVFS.Common
{
public abstract class GVFSPlatform
{
public GVFSPlatform(string executableExtension, string installerExtension)
{
this.Constants = new GVFSPlatformConstants(executableExtension, installerExtension);
}
public static GVFSPlatform Instance { get; private set; }
public abstract IKernelDriver KernelDriver { get; }
public abstract IGitInstallation GitInstallation { get; }
public abstract IDiskLayoutUpgradeData DiskLayoutUpgrade { get; }
public abstract IPlatformFileSystem FileSystem { get; }
public virtual bool IsUnderConstruction { get; } = false;
public virtual bool SupportsGVFSService { get; } = true;
public virtual bool SupportsGVFSUpgrade { get; } = true;
public GVFSPlatformConstants Constants { get; }
public static void Register(GVFSPlatform platform)
{
if (GVFSPlatform.Instance != null)
{
throw new InvalidOperationException("Cannot register more than one platform");
}
GVFSPlatform.Instance = platform;
}
public abstract void StartBackgroundProcess(string programName, string[] args);
public abstract bool IsProcessActive(int processId);
public abstract void IsServiceInstalledAndRunning(string name, out bool installed, out bool running);
public abstract string GetNamedPipeName(string enlistmentRoot);
public abstract NamedPipeServerStream CreatePipeByName(string pipeName);
public abstract string GetOSVersionInformation();
public abstract void InitializeEnlistmentACLs(string enlistmentPath);
public abstract bool IsElevated();
public abstract string GetCurrentUser();
public abstract void ConfigureVisualStudio(string gitBinPath, ITracer tracer);
public abstract bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error);
public abstract bool TryInstallGitCommandHooks(GVFSContext context, string executingDirectory, string hookName, string commandHookPath, out string errorMessage);
public abstract InProcEventListener CreateTelemetryListenerIfEnabled(string providerName, string enlistmentId, string mountId);
public abstract Dictionary<string, string> GetPhysicalDiskInfo(string path, bool sizeStatsOnly);
public abstract bool IsConsoleOutputRedirectedToFile();
public abstract bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage);
public abstract bool IsGitStatusCacheSupported();
public abstract FileBasedLock CreateFileBasedLock(
PhysicalFileSystem fileSystem,
ITracer tracer,
string lockPath);
public bool TryGetNormalizedPathRoot(string path, out string pathRoot, out string errorMessage)
{
pathRoot = null;
errorMessage = null;
string normalizedPath = null;
if (!this.FileSystem.TryGetNormalizedPath(path, out normalizedPath, out errorMessage))
{
return false;
}
pathRoot = Path.GetPathRoot(normalizedPath);
return true;
}
public class GVFSPlatformConstants
{
public static readonly char PathSeparator = Path.DirectorySeparatorChar;
public GVFSPlatformConstants(string executableExtension, string installerExtension)
{
this.ExecutableExtension = executableExtension;
this.InstallerExtension = installerExtension;
}
public string ExecutableExtension { get; }
public string InstallerExtension { get; }
public string GVFSExecutableName
{
get { return "GVFS" + this.ExecutableExtension; }
}
public string GVFSHooksExecutableName
{
get { return "GVFS.Hooks" + this.ExecutableExtension; }
}
public string GVFSReadObjectHookExecutableName
{
get { return "GVFS.ReadObjectHook" + this.ExecutableExtension; }
}
public string GVFSVirtualFileSystemHookExecutableName
{
get { return "GVFS.VirtualFileSystemHook" + this.ExecutableExtension; }
}
public string MountExecutableName
{
get { return "GVFS.Mount" + this.ExecutableExtension; }
}
public string GVFSUpgraderExecutableName
{
get { return "GVFS.Upgrader" + this.ExecutableExtension; }
}
}
}
}