diff --git a/zh-cn/application-dev/application-models/application-context-stage.md b/zh-cn/application-dev/application-models/application-context-stage.md index 6e64c5a4a5bdc1044021706bfc49a1cdbe1f23bb..c380d23e0b3fc6530968ed95171e1958a62344e9 100644 --- a/zh-cn/application-dev/application-models/application-context-stage.md +++ b/zh-cn/application-dev/application-models/application-context-stage.md @@ -84,13 +84,13 @@ | 属性 | 路径 | | -------- | -------- | - | bundleCodeDir | <路径前缀>/el1/bundle/ | - | cacheDir | <路径前缀>/<加密等级>/base/cache/ | - | filesDir | <路径前缀>/<加密等级>/base/files/ | - | preferencesDir | <路径前缀>/<加密等级>/base/preferences/ | - | tempDir | <路径前缀>/<加密等级>/base/temp/ | - | databaseDir | <路径前缀>/<加密等级>/database/ | - | distributedFilesDir | <路径前缀>/el2/distributedFiles/ | + | bundleCodeDir | <路径前缀>/el1/bundle | + | cacheDir | <路径前缀>/<加密等级>/base/cache | + | filesDir | <路径前缀>/<加密等级>/base/files | + | preferencesDir | <路径前缀>/<加密等级>/base/preferences | + | tempDir | <路径前缀>/<加密等级>/base/temp | + | databaseDir | <路径前缀>/<加密等级>/database | + | distributedFilesDir | <路径前缀>/el2/distributedFiles | 示例代码如下所示。 @@ -108,6 +108,9 @@ let distributedFilesDir = applicationContext.distributedFilesDir; let preferencesDir = applicationContext.preferencesDir; ... + // 获取应用文件路径 + let filePath = tempDir + 'test.txt'; + console.info(`filePath: ${filePath}`); } } ``` @@ -116,13 +119,13 @@ | 属性 | 路径 | | -------- | -------- | - | bundleCodeDir | <路径前缀>/el1/bundle/ | - | cacheDir | <路径前缀>/<加密等级>/base/**haps/\**/cache/ | - | filesDir | <路径前缀>/<加密等级>/base/**haps/\**/files/ | - | preferencesDir | <路径前缀>/<加密等级>/base/**haps/\**/preferences/ | - | tempDir | <路径前缀>/<加密等级>/base/**haps/\**/temp/ | - | databaseDir | <路径前缀>/<加密等级>/database/**\**/ | - | distributedFilesDir | <路径前缀>/el2/distributedFiles/**\**/ | + | bundleCodeDir | <路径前缀>/el1/bundle | + | cacheDir | <路径前缀>/<加密等级>/base/**haps/\**/cache | + | filesDir | <路径前缀>/<加密等级>/base/**haps/\**/files | + | preferencesDir | <路径前缀>/<加密等级>/base/**haps/\**/preferences | + | tempDir | <路径前缀>/<加密等级>/base/**haps/\**/temp | + | databaseDir | <路径前缀>/<加密等级>/database/**\** | + | distributedFilesDir | <路径前缀>/el2/distributedFiles/**\** | 示例代码如下所示。 @@ -139,6 +142,9 @@ let distributedFilesDir = this.context.distributedFilesDir; let preferencesDir = this.context.preferencesDir; ... + // 获取应用文件路径 + let filePath = tempDir + 'test.txt'; + console.info(`filePath: ${filePath}`); } } ```