// Used by System.Environment
        internal static string InsecureGetCurrentDirectory()
        {
            MonoIOError error;
            string      result = MonoIO.GetCurrentDirectory(out error);

            if (error != MonoIOError.ERROR_SUCCESS)
            {
                throw MonoIO.GetException(error);
            }
            return(result);
        }
Exemple #2
0
        public static string GetCurrentDirectory()
        {
            MonoIOError error;

            string result = MonoIO.GetCurrentDirectory(out error);

            if (error != MonoIOError.ERROR_SUCCESS)
            {
                throw MonoIO.GetException(error);
            }
#if !NET_2_1 && !DISABLE_SECURITY
            if ((result != null) && (result.Length > 0) && SecurityManager.SecurityEnabled)
            {
                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, result).Demand();
            }
#endif
            return(result);
        }
Exemple #3
0
        public static string GetCurrentDirectory()
        {
            MonoIOError error;

            SecurityManager.EnsureElevatedPermissions();              // this is a no-op outside moonlight

            string result = MonoIO.GetCurrentDirectory(out error);

            if (error != MonoIOError.ERROR_SUCCESS)
            {
                throw MonoIO.GetException(error);
            }
#if !MOONLIGHT
            if ((result != null) && (result.Length > 0) && SecurityManager.SecurityEnabled)
            {
                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, result).Demand();
            }
#endif
            return(result);
        }