MAUI/MAUI Blazor/Blazor Hybrid 环境路径测试笔记 (Android/iOS/Windows/SSR/PWA/WinForm/Wpf)
测试代码
Tools服务类多平台实现
MAUI
public string CacheDirectory() => FileSystem.CacheDirectory;
public string AppDataDirectory() => FileSystem.AppDataDirectory;
其他平台
public string CacheDirectory() => AppDomain.CurrentDomain.BaseDirectory;
public string AppDataDirectory() => AppDomain.CurrentDomain.BaseDirectory;
测试界面
<div>
<br />
<b>
AppDataDirectory:
</b>
<br />
@Tools.AppDataDirectory()
<br /><br />
<b>
CacheDirectory:
</b>
<br />
@Tools.CacheDirectory()
<br /><br />
<b>
BaseDirectory:
</b>
<br />
@AppDomain.CurrentDomain.BaseDirectory
<br /><br />
<b>
DynamicDirectory:
</b>
<br />
@AppDomain.CurrentDomain.DynamicDirectory
<br /><br />
<b>
FriendlyName:
</b>
<br />
@AppDomain.CurrentDomain.FriendlyName
<br /><br />
<b>
ApplicationBase:
</b>
<br />
@AppDomain.CurrentDomain.SetupInformation.ApplicationBase
<br /><br />
<b>
TargetFrameworkName:
</b>
<br />
@AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
<br /><br />
<b>
Environment.SpecialFolder
</b>
<br />
<b>
LocalApplicationData:
</b>
<br />
@Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
<br /><br />
<b>
ApplicationData:
</b>
<br />
@Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
<br /><br />
<b>
MyDocuments:
</b>
<br />
@Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
<br /><br />
<b>
Personal:
</b>
<br />
@Environment.GetFolderPath(Environment.SpecialFolder.Personal)
<br /><br />
<b>
Resources:
</b>
<br />
@Environment.GetFolderPath(Environment.SpecialFolder.Resources)
<br /><br />
Android
iOS
Windows
Blazor PWA
Blazor SSR
Blazor WinForms
Blazor Wpf
项目地址
https://github.com/densen2014/BlazorMaui
https://gitee.com/densen2014/BlazorMaui
关联项目
FreeSql QQ群:4336577、8578575、52508226
BA & Blazor QQ群:795206915、675147445
知识共享许可协议
本作品采用
知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议
进行许可。欢迎转载、使用、重新发布,但务必保留文章署名AlexChow(包含链接: https://github.com/densen2014 ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请
与我联系
。
AlexChow
版权声明:本文为alex_zoucn原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。