Exemple #1
0
        private static bool IsPathTooLongIfRooted(string path)
        {
            bool hasMaxPath = NativeMethodsShared.OSMaxPathLimit != NativeMethodsShared.MaxPathLimits.None;
            int  maxPath    = (int)NativeMethodsShared.OSMaxPathLimit;

            // >= not > because MAX_PATH assumes a trailing null
            return(hasMaxPath && !IsRootedNoThrow(path) && NativeMethodsShared.GetCurrentDirectory().Length + path.Length + 1 /* slash */ >= maxPath);
        }
Exemple #2
0
        internal static string GetCurrentDirectory()
        {
            StringBuilder lpBuffer = new StringBuilder(NativeMethodsShared.MAX_PATH);

            if (NativeMethodsShared.GetCurrentDirectory(NativeMethodsShared.MAX_PATH, lpBuffer) > 0)
            {
                return(lpBuffer.ToString());
            }
            return((string)null);
        }