Folder Paths Win Mac

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Here is a list of the system paths you can retrieve using System.Environment.SpecialFolder( #name goes here# ):
+
Here is a list of the system paths you can retrieve using System.Environment.GetFolderPath.
  
{| class="wikitable"
+
For example:
! Enum !! Name !! Mac !! Win
+
<syntaxhighlight lang="csharp">
|-
+
System.Environment.GetFolderPath( System.Environment.SpecialFolder.ApplicationData )
| 0 || Desktop || /Users/yourname/Desktop || C:\Users\yourname\Desktop
+
</syntaxhighlight>
|-
+
 
| 2 || Programs||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
+
<br/>
|-
+
 
| 5 || Personal|| /Users/yourname || C:\Users\yourname\Documents
+
{| class="wikitable" cellpadding='2'
|-
+
{{OSFolder| id=0 | name=Desktop | osx1068=/Users/yourname/Desktop | win7=C:\Users\yourname\Desktop }}
| 5 || MyDocuments|| /Users/yourname || C:\Users\yourname\Documents
+
{{OSFolder| id=2 | name=Programs | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs }}
|-
+
{{OSFolder| id=5 | name=Personal | osx1068=/Users/yourname | win7=C:\Users\yourname\Documents }}
| 6 || Favorites|| /Users/yourname/Library/Favorites || C:\Users\yourname\Favorites
+
{{OSFolder| id=5 | name=MyDocuments | osx1068=/Users/yourname | win7=C:\Users\yourname\Documents }}
|-
+
{{OSFolder| id=6 | name=Favorites | osx1068=/Users/yourname/Library/Favorites | win7=C:\Users\yourname\Favorites }}
| 7 || Startup||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
+
{{OSFolder| id=7 | name=Startup | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup }}
|-
+
{{OSFolder| id=8 | name=Recent | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Recent }}
| 8 || Recent||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Recent
+
{{OSFolder| id=9 | name=SendTo | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\SendTo }}
|-
+
{{OSFolder| id=11 | name=StartMenu | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu }}
| 9 || SendTo||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\SendTo
+
{{OSFolder| id=13 | name=MyMusic | osx1068=/Users/yourname/Music | win7=C:\Users\yourname\Music }}
|-
+
{{OSFolder| id=16 | name=DesktopDirectory | osx1068=/Users/yourname/Desktop | win7=C:\Users\yourname\Desktop }}
| 11 || StartMenu||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu
+
{{OSFolder| id=17 | name=MyComputer }}
|-
+
{{OSFolder| id=21 | name=Templates | osx1068=/Users/yourname/Templates | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Templates }}
| 13 || MyMusic|| /Users/yourname/Music || C:\Users\yourname\Music
+
{{OSFolder| id=26 | name=ApplicationData | osx1068=/Users/yourname/.config | win7=C:\Users\yourname\AppData\Roaming }}
|-
+
{{OSFolder| id=28 | name=LocalApplicationData | osx1068=/Users/username/.local/share (inside unity) <br/>/Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/Current/share | win7=C:\Users\yourname\AppData\Local }}
| 16 || DesktopDirectory|| /Users/yourname/Desktop || C:\Users\yourname\Desktop
+
{{OSFolder| id=32 | name=InternetCache | osx1068=/Users/yourname/Library/Caches | win7=C:\Users\yourname\AppData\Local\Microsoft\Windows\Temporary Internet Files }}
|-
+
{{OSFolder| id=33 | name=Cookies | win7=C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Cookies }}
| 17 || MyComputer||  ||
+
{{OSFolder| id=34 | name=History | win7=C:\Users\yourname\AppData\Local\Microsoft\Windows\History }}
|-
+
{{OSFolder| id=35 | name=CommonApplicationData | osx1068=/usr/share | win7=C:\ProgramData }}
| 21 || Templates|| /Users/yourname/Templates || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Templates
+
{{OSFolder| id=37 | name=System | win7=C:\Windows\system32 }}
|-
+
{{OSFolder| id=38 | name=ProgramFiles | osx1068=/Applications | win7=C:\Program Files<br/>''or'' C:\Program Files (x86) }}
| 26 || ApplicationData|| /Users/yourname/.config || C:\Users\yourname\AppData\Roaming
+
{{OSFolder| id=39 | name=MyPictures | osx1068=/Users/yourname/Pictures | win7=C:\Users\yourname\Pictures }}
|-
+
{{OSFolder| id=43 | name=CommonProgramFiles | win7=C:\Program Files\Common Files<br/>''or'' C:\Program Files (x86)\Common Files }}
| 28 || LocalApplicationData|| /Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/Current/share || C:\Users\yourname\AppData\Local
+
|-
+
| 32 || InternetCache|| /Users/yourname/Library/Caches || C:\Users\yourname\AppData\Local\Microsoft\Windows\Temporary Internet Files
+
|-
+
| 33 || Cookies||  || C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Cookies
+
|-
+
| 34 || History||  || C:\Users\yourname\AppData\Local\Microsoft\Windows\History
+
|-
+
| 35 || CommonApplicationData|| /usr/share || C:\ProgramData
+
|-
+
| 37 || System||  || C:\Windows\system32
+
|-
+
| 38 || ProgramFiles|| /Applications || C:\Program Files<br/>or C:\Program Files (x86)
+
|-
+
| 39 || MyPictures|| /Users/yourname/Pictures || C:\Users\yourname\Pictures
+
|-
+
| 43 || CommonProgramFiles||  || C:\Program Files\Common Files<br/>or C:\Program Files (x86)\Common Files
+
 
|}
 
|}
  
Line 84: Line 67:
  
 
<br/>
 
<br/>
 +
 +
[[Category:KnowHow]]
 +
[[Category:C Sharp]]
 +
[[Category:Utility]]

Latest revision as of 11:16, 29 November 2013

Here is a list of the system paths you can retrieve using System.Environment.GetFolderPath.

For example:

System.Environment.GetFolderPath( System.Environment.SpecialFolder.ApplicationData )



Desktop (0)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Desktop
Windows7.gif Windows 7 C:\Users\yourname\Desktop

Programs (2)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

Personal (5)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname
Windows7.gif Windows 7 C:\Users\yourname\Documents

MyDocuments (5)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname
Windows7.gif Windows 7 C:\Users\yourname\Documents

Favorites (6)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Library/Favorites
Windows7.gif Windows 7 C:\Users\yourname\Favorites

Startup (7)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Recent (8)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Recent

SendTo (9)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\SendTo

StartMenu (11)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Start Menu

MyMusic (13)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Music
Windows7.gif Windows 7 C:\Users\yourname\Music

DesktopDirectory (16)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Desktop
Windows7.gif Windows 7 C:\Users\yourname\Desktop

MyComputer (17)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 n/a

Templates (21)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Templates
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Templates

ApplicationData (26)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/.config
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming

LocalApplicationData (28)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/username/.local/share (inside unity)
/Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/Current/share
Windows7.gif Windows 7 C:\Users\yourname\AppData\Local

InternetCache (32)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Library/Caches
Windows7.gif Windows 7 C:\Users\yourname\AppData\Local\Microsoft\Windows\Temporary Internet Files

Cookies (33)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Roaming\Microsoft\Windows\Cookies

History (34)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Users\yourname\AppData\Local\Microsoft\Windows\History

CommonApplicationData (35)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /usr/share
Windows7.gif Windows 7 C:\ProgramData

System (37)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Windows\system32

ProgramFiles (38)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Applications
Windows7.gif Windows 7 C:\Program Files
or C:\Program Files (x86)

MyPictures (39)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) /Users/yourname/Pictures
Windows7.gif Windows 7 C:\Users\yourname\Pictures

CommonProgramFiles (43)
Apple.gif Mac OS X 10.6.8 (Snow Leopard) n/a
Windows7.gif Windows 7 C:\Program Files\Common Files
or C:\Program Files (x86)\Common Files

[edit] Code

[edit] Stand-alone

using System;
 
class Test
{
	static int Main(String[] argv)
	{
		var names = Enum.GetNames(typeof(Environment.SpecialFolder));
		var values = Enum.GetValues(typeof(Environment.SpecialFolder));
		for(int i = 0; i < names.Length; ++i)
			Console.WriteLine("{0} {1}: {2}", (int)values.GetValue(i), names[i], Environment.GetFolderPath((Environment.SpecialFolder)values.GetValue(i)));
 
		return 0;
	}
}


[edit] Inside Unity

var names = System.Enum.GetNames( typeof( System.Environment.SpecialFolder ) );
var values = System.Enum.GetValues( typeof( System.Environment.SpecialFolder ) );
for( int i = 0; i < names.Length; ++i )
    Debug.Log( (int)values.GetValue( i ) + " " + names[i] + ": " + System.Environment.GetFolderPath( (System.Environment.SpecialFolder)values.GetValue( i ) ) );


Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox