跳到主要内容

Application路径HarmonyOS平台映射关系

问题描述

团结引擎Application路径对应的项目工程、平台文件系统具体位置是什么?

解决方案

  • Application.streamingAssetsPath对应DevEco Studio工程路径是 /entry/src/main/resources/rawfile/Data/StreamingAssets ,在使用OpenHarmony API 9设备上的路径为data/storage/el1/bundle/entry/resources/rawfile/Data/StreamingAssets(应用沙箱路径,非文件系统实际路径),在API 10的设备上该路径已不可见。Application.dataPath对应Application.streamingAssetsPath的上一级目录。

  • Application.persistentPath的应用沙箱路径是 /data/storage/el2/base/haps/entry/files,文件系统实际路径为/data/app/el2/100/base//haps/entry/files 。Application对应同级的cache目录。

您可以使用如下命令在文件传输时使用文件系统实际路径。

hdc file send

Application路径与HarmonyOS平台取值的对应关系总结为下表:

Application路径

HarmonyOS平台取值

Application.streamingAssetsPath

rawfile/Data/StreamingAssets

Application.persistentPath

/data/storage/el2/base/haps/entry/files

Application.dataPath

rawfile/Data

Application.temporaryCachePath

/data/storage/el2/base/haps/entry/cache