「.NET 8 for Macの特殊ディレクトリのパス」の版間の差分
Administrator (トーク | 投稿記録) 編集の要約なし |
Administrator (トーク | 投稿記録) 編集の要約なし |
||
| (同じ利用者による、間の1版が非表示) | |||
| 148行目: | 148行目: | ||
| | | | ||
|} | |} | ||
== 解説 == | |||
MyDocumentsが「ホームディレクトリ直下」から「Documentsディレクトリ」に変更になっています。 | MyDocumentsが「ホームディレクトリ直下」から「Documentsディレクトリ」に変更になっています。 | ||
| 156行目: | 158行目: | ||
ApplicationDataと LocalApplicationDataは独自の隠しディレクトリからmacOSのルールに則った「~/Library/Application Support」になっています。 | ApplicationDataと LocalApplicationDataは独自の隠しディレクトリからmacOSのルールに則った「~/Library/Application Support」になっています。 | ||
TemplatesとCommonTemplatesは何も返さなくなっています。 | |||
== コード == | |||
<source lang=csharp> | <source lang=csharp> | ||
foreach (var folder in Enum.GetValues(typeof(Environment.SpecialFolder))) | foreach (var folder in Enum.GetValues(typeof(Environment.SpecialFolder))) | ||
| 164行目: | 169行目: | ||
</source> | </source> | ||
[[category: .NET]] | == 関連項目 == | ||
* [[.NET 8 for Androidの特殊ディレクトリのパス]] | |||
[[category: .NET for Mac]] | |||
2024年10月21日 (月) 06:10時点における最新版
.NET 8 for MacではXamarin.Macの頃から微妙に戻り値が変わっています。 .NET 6や.NET 7は試していません。
| SpecialFolder | .NET | Xamarin |
|---|---|---|
| Desktop | /Users/{ユーザー名}/Desktop | 同じ |
| Programs | ||
| MyDocuments | /Users/{ユーザー名}/Documents | /Users/{ユーザー} |
| MyDocuments | /Users/{ユーザー名}/Documents | /Users/{ユーザー} |
| Favorites | /Users/{ユーザー名}/Library/Favorites | 同じ |
| Startup | ||
| Recent | ||
| SendTo | ||
| StartMenu | ||
| MyMusic | /Users/{ユーザー名}/Music | 同じ |
| MyVideos | /Users/{ユーザー名}/Movies | /Users/{ユーザー}/Videos |
| DesktopDirectory | /Users/{ユーザー名}/Desktop | 同じ |
| MyComputer | ||
| NetworkShortcuts | ||
| Fonts | /Users/{ユーザー名}/Library/Fonts | 同じ |
| Templates | /Users/{ユーザー}/Templates | |
| CommonStartMenu | ||
| CommonPrograms | ||
| CommonStartup | ||
| CommonDesktopDirectory | ||
| ApplicationData | /Users/{ユーザー名}/Library/Application Support | /Users/{ユーザー}/.config |
| PrinterShortcuts | ||
| LocalApplicationData | /Users/{ユーザー名}/Library/Application Support | /Users/{ユーザー}/.local/share |
| InternetCache | /Users/{ユーザー名}/Library/Caches | 同じ |
| Cookies | ||
| History | ||
| CommonApplicationData | /usr/share | 同じ |
| Windows | ||
| System | /System | |
| ProgramFiles | /Applications | 同じ |
| MyPictures | /Users/{ユーザー名}/Pictures | 同じ |
| UserProfile | /Users/{ユーザー名} | 同じ |
| SystemX86 | ||
| ProgramFilesX86 | ||
| CommonProgramFiles | ||
| nProgramFilesX86 | ||
| CommonTemplates | /usr/share/templates | |
| CommonDocuments | ||
| CommonAdminTools | ||
| AdminTools | ||
| CommonMusic | ||
| CommonPictures | ||
| CommonVideos | ||
| Resources | ||
| LocalizedResources | ||
| CommonOemLinks | ||
| CDBurning |
解説[編集 | ソースを編集]
MyDocumentsが「ホームディレクトリ直下」から「Documentsディレクトリ」に変更になっています。
ホームディレクトリはUserProfileで取得するようになりました。
MyVideoはVideosディレクトリからMoviesディレクトリになっています。
ApplicationDataと LocalApplicationDataは独自の隠しディレクトリからmacOSのルールに則った「~/Library/Application Support」になっています。
TemplatesとCommonTemplatesは何も返さなくなっています。
コード[編集 | ソースを編集]
foreach (var folder in Enum.GetValues(typeof(Environment.SpecialFolder)))
{
var path = Environment.GetFolderPath((Environment.SpecialFolder)folder);
Console.WriteLine($"{folder} => {path}");
}