• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# raw_dir.h
2
3## Overview
4
5Provides functions related to the **rawfile** directory. These functions include traversing and closing rawfile directories.
6
7**File to include**: <rawfile/raw_dir.h>
8
9**Library**: librawfile.z.so
10
11**System capability**: SystemCapability.Global.ResourceManager
12
13**Since**: 8
14
15**Related module**: [rawfile](capi-rawfile.md)
16
17## Summary
18
19### Structs
20
21| Name| typedef Keyword| Description|
22| -- | -- | -- |
23| [RawDir](capi-rawfile-rawdir.md) | RawDir | Provides access to the **rawfile** directory.|
24
25### Functions
26
27| Name| Description                                                                                                                                     |
28| -- |-----------------------------------------------------------------------------------------------------------------------------------------|
29| [const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index)](#oh_resourcemanager_getrawfilename) | Obtains the name of a file in **rawfile** based on the index. You can use this function to traverse the **rawfile** directory.                                                                                                  |
30| [int OH_ResourceManager_GetRawFileCount(RawDir *rawDir)](#oh_resourcemanager_getrawfilecount) | Obtains the number of rawfiles in [RawDir](capi-rawfile-rawdir.md). You can use this function to obtain available indexes in [OH_ResourceManager_GetRawFileName](capi-raw-dir-h.md#oh_resourcemanager_getrawfilename).|
31| [void OH_ResourceManager_CloseRawDir(RawDir *rawDir)](#oh_resourcemanager_closerawdir) | Closes an opened [RawDir](capi-rawfile-rawdir.md) and releases all associated resources.                                                                                                        |
32
33## Function Description
34
35### OH_ResourceManager_GetRawFileName()
36
37```
38const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index)
39```
40
41**Description**
42
43Obtains the name of a file in **rawfile** based on the index. You can use this function to traverse the **rawfile** directory.
44
45**Since**: 8
46
47
48**Parameters**
49
50| Name| Description|
51| -- | -- |
52| [RawDir](capi-rawfile-rawdir.md) *rawDir | Pointer to [RawDir](capi-rawfile-rawdir.md).|
53| int index | Index of the rawfile in [RawDir](capi-rawfile-rawdir.md).|
54
55**Returns**
56
57| Type| Description                                                                                                                                                    |
58| -- |--------------------------------------------------------------------------------------------------------------------------------------------------------|
59| const char * | File name obtained if the rawfile exists in the directory. The file name returned can be used as the input parameter of [OH_ResourceManager_OpenRawFile](capi-raw-file-manager-h.md#oh_resourcemanager_openrawfile).<br> If no file is found after all files in the directory are traversed, **NULL** is returned.|
60
61**Reference**
62
63[OH_ResourceManager_OpenRawFile](capi-raw-file-manager-h.md#oh_resourcemanager_openrawfile)
64
65### OH_ResourceManager_GetRawFileCount()
66
67```
68int OH_ResourceManager_GetRawFileCount(RawDir *rawDir)
69```
70
71**Description**
72
73Obtains the number of rawfiles in [RawDir](capi-rawfile-rawdir.md). You can use this function to obtain available indexes in [OH_ResourceManager_GetRawFileName](capi-raw-dir-h.md#oh_resourcemanager_getrawfilename).
74
75**Since**: 8
76
77
78**Parameters**
79
80| Name| Description|
81| -- | -- |
82| [RawDir](capi-rawfile-rawdir.md) *rawDir | Pointer to [RawDir](capi-rawfile-rawdir.md).|
83
84**Returns**
85
86| Type| Description|
87| -- | -- |
88| int | Number of files in **rawDir**. If **rawDir** is empty, **0** is returned.|
89
90**Reference**
91
92[OH_ResourceManager_GetRawFileName](capi-raw-dir-h.md#oh_resourcemanager_getrawfilename)
93
94### OH_ResourceManager_CloseRawDir()
95
96```
97void OH_ResourceManager_CloseRawDir(RawDir *rawDir)
98```
99
100**Description**
101
102Closes an opened [RawDir](capi-rawfile-rawdir.md) and releases all associated resources.
103
104**Since**: 8
105
106
107**Parameters**
108
109| Name| Description|
110| -- | -- |
111| [RawDir](capi-rawfile-rawdir.md) *rawDir | Pointer to [RawDir](capi-rawfile-rawdir.md).|
112
113**Reference**
114
115[OH_ResourceManager_OpenRawDir](capi-raw-file-manager-h.md#oh_resourcemanager_openrawdir)
116