Skip to content

Commit 2fa4a41

Browse files
committed
harmony update , 适配RN0330分支框架。
1 parent 5811af7 commit 2fa4a41

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

harmony/fs.har

-47 Bytes
Binary file not shown.

harmony/fs/src/main/ets/FsTurboModule.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ import buffer from '@ohos.buffer';
3232
import HashMap from '@ohos.util.HashMap';
3333
import Logger from './Logger';
3434

35-
let context = getContext(this) as common.ApplicationContext; // ApplicationContext
36-
3735
const TAG: string = "[RNOH] Fs"
3836

3937
interface StatResult {
@@ -46,13 +44,15 @@ interface StatResult {
4644
}
4745

4846
export class FsTurboModule extends TurboModule {
47+
48+
context = getContext(this) as common.ApplicationContext; // ApplicationContext
4949
// 常量
5050
getConstants(): object {
5151
return {
5252
// 沙箱路径
53-
FileSandBoxPath: context.filesDir,
53+
FileSandBoxPath: this.context.filesDir,
5454
// 缓存路径
55-
FileCachePath: context.cacheDir,
55+
FileCachePath: this.context.cacheDir,
5656
// 文件
5757
RNFSFileTypeRegular: 0,
5858
// 文件夹
@@ -145,7 +145,7 @@ export class FsTurboModule extends TurboModule {
145145
// 资源文件内容读取
146146
readFileAssets(path: string): Promise<string> {
147147
return new Promise((resolve, reject) => {
148-
context.resourceManager.getRawFileContent(
148+
this.context.resourceManager.getRawFileContent(
149149
path, (err: BusinessError, value) => {
150150
if (err) {
151151
reject(err.message);

0 commit comments

Comments
 (0)