File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ import buffer from '@ohos.buffer';
32
32
import HashMap from '@ohos.util.HashMap' ;
33
33
import Logger from './Logger' ;
34
34
35
- let context = getContext ( this ) as common . ApplicationContext ; // ApplicationContext
36
-
37
35
const TAG : string = "[RNOH] Fs"
38
36
39
37
interface StatResult {
@@ -46,13 +44,15 @@ interface StatResult {
46
44
}
47
45
48
46
export class FsTurboModule extends TurboModule {
47
+
48
+ context = getContext ( this ) as common . ApplicationContext ; // ApplicationContext
49
49
// 常量
50
50
getConstants ( ) : object {
51
51
return {
52
52
// 沙箱路径
53
- FileSandBoxPath : context . filesDir ,
53
+ FileSandBoxPath : this . context . filesDir ,
54
54
// 缓存路径
55
- FileCachePath : context . cacheDir ,
55
+ FileCachePath : this . context . cacheDir ,
56
56
// 文件
57
57
RNFSFileTypeRegular : 0 ,
58
58
// 文件夹
@@ -145,7 +145,7 @@ export class FsTurboModule extends TurboModule {
145
145
// 资源文件内容读取
146
146
readFileAssets ( path : string ) : Promise < string > {
147
147
return new Promise ( ( resolve , reject ) => {
148
- context . resourceManager . getRawFileContent (
148
+ this . context . resourceManager . getRawFileContent (
149
149
path , ( err : BusinessError , value ) => {
150
150
if ( err ) {
151
151
reject ( err . message ) ;
You can’t perform that action at this time.
0 commit comments