1# Environment
2
3
4## Overview
5
6Provides the capability of obtaining the root directory of user files.
7
8**Since**: 12
9
10
11## Summary
12
13
14### Files
15
16| Name| Description|
17| -------- | -------- |
18| [oh_environment.h](oh__environment_8h.md) | Defines the native APIs used to obtain the sandbox paths of the user files. |
19
20
21### Functions
22
23| Name| Description|
24| -------- | -------- |
25| [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode) [OH_Environment_GetUserDownloadDir](#oh_environment_getuserdownloaddir) (char \*\*result) | Obtains the sandbox path of the **Download** root directory. This function is available only for 2-in-1 devices.|
26| [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode) [OH_Environment_GetUserDesktopDir](#oh_environment_getuserdesktopdir) (char \*\*result) | Obtains the sandbox path of the **Desktop** root directory. This function is available only for 2-in-1 devices.|
27| [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode) [OH_Environment_GetUserDocumentDir](#oh_environment_getuserdocumentdir) (char \*\*result) | Obtains the sandbox path of the **Documents** root directory. This function is available only for 2-in-1 devices.|
28
29
30## Function Description
31
32
33### OH_Environment_GetUserDesktopDir()
34
35```
36FileManagement_ErrCode OH_Environment_GetUserDesktopDir (char ** result)
37```
38**Description**
39Obtains the sandbox path of the **Desktop** root directory.
40
41**Since**: 12
42
43**Parameters**
44
45| Name| Description|
46| -------- | -------- |
47| result | Pointer to the sandbox path of the **Desktop** root directory obtained. You also need to include **malloc.h** and use **free()** to release the memory allocated. |
48
49**Returns**
50
51Returns [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode).
52
53
54### OH_Environment_GetUserDocumentDir()
55
56```
57FileManagement_ErrCode OH_Environment_GetUserDocumentDir (char ** result)
58```
59**Description**
60Obtains the sandbox path of the **Documents** root directory.
61
62**Since**: 12
63
64**Parameters**
65
66| Name| Description|
67| -------- | -------- |
68| result | Pointer to the sandbox path of the **Documents** root directory obtained. You also need to include **malloc.h** and use **free()** to release the memory allocated. |
69
70**Returns**
71
72Returns [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode).
73
74
75### OH_Environment_GetUserDownloadDir()
76
77```
78FileManagement_ErrCode OH_Environment_GetUserDownloadDir (char ** result)
79```
80**Description**
81Obtains the sandbox path of the **Download** root directory.
82
83**Since**: 12
84
85**Parameters**
86
87| Name| Description|
88| -------- | -------- |
89| result | Pointer to the path of the **Download** root directory obtained. You also need to include **malloc.h** and use **free()** to release the memory allocated. |
90
91**Returns**
92
93Returns [FileManagement_ErrCode](_file_i_o.md#filemanagement_errcode).
94