private static bool ValidateXmlPath(string xmlPath, bool isFile = false)
        {
            if (isFile)
            {
                if (File.Exists(xmlPath))
                {
                    Logger.Debug("File path validated: {0}", xmlPath);
                    return(true);
                }
            }
            else
            {
                if (Directory.Exists(xmlPath))
                {
                    Logger.Debug("Directory path validated: {0}", xmlPath);
                    return(true);
                }
            }

            // TODO: might fail on linux
            IReparsePointProvider provider = ReparsePointFactory.Provider;
            LinkType linkType = provider.GetLinkType(xmlPath);

            switch (linkType)
            {
            case LinkType.Junction:
            case LinkType.Symbolic:
                Logger.Debug("Directory path validated as junction point or symbolic link: {0}", xmlPath);
                return(true);

            default:
                return(false);
            }
        }
Beispiel #2
0
        private static bool ValidateXmlPath(string xmlPath, bool isFile = false)
        {
            if (isFile)
            {
                if (File.Exists(xmlPath))
                {
                    Logger.Debug("File path validated: {0}", xmlPath);
                    return(true);
                }
            }
            else
            {
                if (Directory.Exists(xmlPath))
                {
                    Logger.Debug("Directory path validated: {0}", xmlPath);
                    return(true);
                }
            }

            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(false);
            }

            IReparsePointProvider provider = ReparsePointFactory.Provider;
            LinkType linkType = provider.GetLinkType(xmlPath);

            switch (linkType)
            {
            case LinkType.Junction:
            case LinkType.Symbolic:
                Logger.Debug("Directory path validated as junction point or symbolic link: {0}", xmlPath);
                return(true);

            default:
                return(false);
            }
        }