public string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) { return(this.EncapsulateWithExtension( () => System.Environment.GetFolderPath(folder, option), e => e.BeginGetFolderPath(folder, option), (e, r) => e.EndGetFolderPath(r, folder, option), (IEnvironmentExtension e, ref Exception exception) => e.FailGetFolderPath(ref exception, folder, option))); }
static StackObject *GetFolderPath_24(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Environment.SpecialFolderOption @option = (System.Environment.SpecialFolderOption) typeof(System.Environment.SpecialFolderOption).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Environment.SpecialFolder @folder = (System.Environment.SpecialFolder) typeof(System.Environment.SpecialFolder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = System.Environment.GetFolderPath(@folder, @option); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
/// <summary> /// Gets the path to the system special folder that is identified by the specified enumeration. /// </summary> /// <param name="folder">An enumerated constant that identifies a system special folder.</param> /// <param name="option">Specifies options to use for accessing a special folder.</param> /// <returns>The path to the specified system special folder, if that folder physically exists /// on your computer; otherwise, an empty string ("")</returns> public static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option = SpecialFolderOption.None) { // check if there is profile redirect if (s_envVars != null) { string envVar = null; switch (folder) { case SpecialFolder.InternetCache: envVar = "INTERNETCACHE"; break; case SpecialFolder.History: envVar = "INTERNETHISTORY"; break; case SpecialFolder.ApplicationData: envVar = "APPDATA"; break; case SpecialFolder.LocalApplicationData: envVar = "LOCALAPPDATA"; break; case SpecialFolder.UserProfile: envVar = "USERPROFILE"; break; case SpecialFolder.Cookies: envVar = "INETCOOKIES"; break; } if (envVar != null && s_envVars.TryGetValue(envVar, out var path)) { return(path); } } // there is either no profile redirect or we could not find the corresponding path in the provided dictionary return(Environment.GetFolderPath(folder, option)); }
public string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) { return(this.SurroundWithExtension(() => System.Environment.GetFolderPath(folder, option), folder, option)); }
/// <summary> /// Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders. /// </summary> /// folder: One of the enumeration values that identifies a system special folder. /// option: One of the enumeration values that specifies options to use for accessing a special folder. public string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) => System.Environment.GetFolderPath(folder, option);
// .NET Core doesn't currently have APIs to get the "special" folders (ie the ones defined in the Environment.SpecialFolder enum) // The code here is mostly copied out of the .NET reference source for this functionality /// <summary> /// Gets the path to the system special folder that is identified by the specified enumeration. /// </summary> /// <param name="folder">An enumerated constant that identifies a system special folder.</param> /// <param name="option">Specifies options to use for accessing a special folder.</param> /// <returns>The path to the specified system special folder, if that folder physically exists /// on your computer; otherwise, an empty string ("")</returns> public static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option = SpecialFolderOption.None) { return(Environment.GetFolderPath(folder, option)); }
/** * // Summary: * // Gets the path to the system special folder that is identified by the specified * // enumeration, and uses a specified option for accessing special folders. * // * // Parameters: * // folder: * // An enumerated constant that identifies a system special folder. * // * // option: * // Specifies options to use for accessing a special folder. * // * // Returns: * // The path to the specified system special folder, if that folder physically * // exists on your computer; otherwise, an empty string ("").A folder will not * // physically exist if the operating system did not create it, the existing * // folder was deleted, or the folder is a virtual directory, such as My Computer, * // which does not correspond to a physical path. * // * // Exceptions: * // System.ArgumentException: * // folder is not a member of System.Environment.SpecialFolder * // * // System.PlatformNotSupportedException: * // System.PlatformNotSupportedException */public static string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) { return(System.Environment.GetFolderPath(folder, option)); }
/// <summary>An Environment.SpecialFolder extension method that gets folder path.</summary> /// <param name="this">this.</param> /// <param name="option">The option.</param> /// <returns>The folder path.</returns> public static string GetFolderPath(this System.Environment.SpecialFolder @this, System.Environment.SpecialFolderOption option) { return(System.Environment.GetFolderPath(@this, option)); }