Unity3d_获取系统地址

来源:互联网 发布:算法那本书好 编辑:程序博客网 时间:2024/06/01 10:50

有把一些东东保存到系统目录的想法

获取系统目录需要用到System.Environment.GetFolderPath

System.Environment.SpecialFolder 枚举类型包含了以下几种(http://docs.go-mono.com/monodoc.ashx?link=T%3aSystem.Environment.SpecialFolder)

Member NameDescriptionAdminToolsApplicationDataThe directory for application data specific to the user executing the program. On non-Windows operating systems, this path is the value of the environment variable XDG_CONFIG_HOME if it is set, otherwise the ".config" directory in the current user's home directory.CDBurningDocumentation for this section has not yet been entered.CommonAdminToolsDocumentation for this section has not yet been entered.CommonApplicationDataThe directory for data shared by applications. On non-Windows operating systems, the "/usr/share" directory.CommonDesktopDirectoryDocumentation for this section has not yet been entered.CommonDocumentsDocumentation for this section has not yet been entered.CommonMusicDocumentation for this section has not yet been entered.CommonOemLinksDocumentation for this section has not yet been entered.CommonPicturesDocumentation for this section has not yet been entered.CommonProgramFilesThe CommonProgramFiles directory. Not available non-Windows operating systems.CommonProgramFilesX86Documentation for this section has not yet been entered.CommonProgramsDocumentation for this section has not yet been entered.CommonStartMenuDocumentation for this section has not yet been entered.CommonStartupDocumentation for this section has not yet been entered.CommonTemplatesDocumentation for this section has not yet been entered.CommonVideosDocumentation for this section has not yet been entered.CookiesThe cookies directory. Not available non-Windows operating systems.DesktopThe desktop directory. On Unix operating systems, this is either XDG_DESKTOP_DIR from the environment, XDG_DESKTOP_DIR as read from the "user-dirs.dirs" within the SpecialFolder.ApplicationData directory, or as a last resort, the directory named "Desktop" within the SpecialFolder.Personal directory (usually the home directory).DesktopDirectoryThe same as the Desktop enumeration value.FavoritesThe Favorites directory.FontsThe fonts directory, on MacOS X this is ~/Library/Fonts, on other Unix operating systems it is ~/.fonts/HistoryThe History directory. Not available non-Windows operating systems.InternetCacheThe Internet cache directory.LocalApplicationDataThe directory for application data shared by users of the computer. On non-Windows operating systems, this path is the value of the environment variable XDG_DATA_HOME if it is set, otherwise the ".local/share" directory in the current user's home directory.LocalizedResourcesDocumentation for this section has not yet been entered.MyComputerThe My Computer directory. Not available non-Windows operating systems.MyDocumentsDocumentation for this section has not yet been entered.MyMusicThe music directory. On MacOS X this is ~/Music. On other Unix operating systems, this is either XDG_MUSIC_DIR from the environment, XDG_MUSIC_DIR as read from the "user-dirs.dirs" within the SpecialFolder.ApplicationData directory, or as a last resort, the directory named "Music" within the SpecialFolder.Personal directory (usually the home directory).MyPicturesThe pictures directory. On MacOS X this is ~/Pictures. On other Unix operating systems, this is either XDG_PICTURES_DIR from the environment, XDG_PICTURES_DIR as read from the "user-dirs.dirs" within the SpecialFolder.ApplicationData directory, or as a last resort, the directory named "Pictures" within the SpecialFolder.Personal directory (usually the home directory).MyVideosDocumentation for this section has not yet been entered.NetworkShortcutsDocumentation for this section has not yet been entered.PersonalThe personal or home directory for the current user. On non-Windows operating systems, this is the user's home directory.PrinterShortcutsDocumentation for this section has not yet been entered.ProgramFilesWhere program files are located.ProgramFilesX86Documentation for this section has not yet been entered.ProgramsThe Programs directory. Not available non-Windows operating systems.RecentThe Recent files directory. Not available non-Windows operating systems.ResourcesDocumentation for this section has not yet been entered.SendToThe SendTo directory. Not available non-Windows operating systems.StartMenuThe directory displayed by the start menu. Not available non-Windows operating systems.StartupThe Startup directory. Not available non-Windows operating systems.SystemThe system directory. Not available non-Windows operating systems.SystemX86Documentation for this section has not yet been entered.TemplatesThe Templates directory. Not available non-Windows operating systems.UserProfileDocumentation for this section has not yet been entered.WindowsDocumentation for this section has not yet been entered.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0
而MSDN版本http://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.80).aspx
 Member nameDescriptionSupported by the .NET Compact FrameworkApplicationDataThe directory that serves as a common repository for application-specific data for the current roaming user.

A roaming user works on more than one computer on a network. A roaming user's profile is kept on a server on the network and is loaded onto a system when the user logs on.

 CommonApplicationDataThe directory that serves as a common repository for application-specific data that is used by all users. CommonProgramFilesThe directory for components that are shared across applications. CookiesThe directory that serves as a common repository for Internet cookies. DesktopThe logical Desktop rather than the physical file system location. DesktopDirectoryThe directory used to physically store file objects on the desktop.

Do not confuse this directory with the desktop folder itself, which is a virtual folder.

Supported by the .NET Compact FrameworkFavoritesThe directory that serves as a common repository for the user's favorite items. HistoryThe directory that serves as a common repository for Internet history items. InternetCacheThe directory that serves as a common repository for temporary Internet files. LocalApplicationDataThe directory that serves as a common repository for application-specific data that is used by the current, non-roaming user. MyComputerThe "My Computer" folder. 
NoteNote

The MyComputer constant always yields the empty string ("") because no path is defined for the My Computer folder.

 MyDocumentsThe "My Documents" folder. MyMusicThe "My Music" folder. MyPicturesThe "My Pictures" folder.Supported by the .NET Compact FrameworkPersonalThe directory that serves as a common repository for documents. ProgramFilesThe program files directory.Supported by the .NET Compact FrameworkProgramsThe directory that contains the user's program groups. RecentThe directory that contains the user's most recently used documents. SendToThe directory that contains the Send To menu items.Supported by the .NET Compact FrameworkStartMenuThe directory that contains the Start menu items.Supported by the .NET Compact FrameworkStartupThe directory that corresponds to the user's Startup program group.

The system starts these programs whenever a user logs on or starts Windows NT or later, or starts Windows 98.

 SystemThe System directory. TemplatesThe directory that serves as a common repository for document templates.
Remarks

The system special folders are folders such as Program Files, Programs, System, or Startup, which contain common information. Special folders are set by default by the system, or explicitly by the user, when installing a version of Windows.

The GetFolderPath method uses these enumerated constants to designate the special folder path to retrieve.

For more information about special folders, see the CSIDL Values topic at http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/reference/enums/csidl.asp.

Platforms

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, seeSystem Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0
See Also

Reference

System Namespace