コード例 #1
0
        private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                return(LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage));
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                return(MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage));
            }

            // Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll).
            enlistmentRoot = null;

            string finalDirectory;

            if (!WindowsFileSystem.TryGetNormalizedPathImplementation(directory, out finalDirectory, out errorMessage))
            {
                return(false);
            }

            const string dotGVFSRoot = ".gvfs";

            enlistmentRoot = Paths.GetRoot(finalDirectory, dotGVFSRoot);
            if (enlistmentRoot == null)
            {
                errorMessage = $"Failed to find the root directory for {dotGVFSRoot} in {finalDirectory}";
                return(false);
            }

            return(true);
        }
コード例 #2
0
 public static bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage)
 {
     return(LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage));
 }