1# oh_environment.h 2 3## Overview 4 5Defines the native APIs used to obtain the sandbox paths of the user files. 6 7**Header file**: <filemanagement/environment/oh_environment.h> 8 9**Library**: libohenvironment.so 10 11**System capability**: SystemCapability.FileManagement.File.Environment.FolderObtain 12 13**Since**: 12 14 15**Related module**: [Environment](capi-environment.md) 16 17## Summary 18 19### Functions 20 21| Name| Description| 22| -- | -- | 23| [FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result)](#oh_environment_getuserdownloaddir) | Obtains the sandbox path of the **Download** root directory.| 24| [FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result)](#oh_environment_getuserdesktopdir) | Obtains the sandbox path of the **Desktop** root directory.| 25| [FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result)](#oh_environment_getuserdocumentdir) | Obtains the sandbox path of the **Document** root directory.| 26 27## Function Description 28 29### OH_Environment_GetUserDownloadDir() 30 31``` 32FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result) 33``` 34 35**Description** 36 37Obtains the sandbox path of the **Download** root directory. 38 39**Required permissions**: ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY 40 41**Since**: 12 42 43 44**Parameters** 45 46| Name| Description| 47| -- | -- | 48| char **result | Double pointer to the path of the **Download** root directory. You also need to include **malloc.h** and use **free()** to release the memory allocated.| 49 50**Returns** 51 52| Type| Description| 53| -- | -- | 54| [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode) | Returns [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode).| 55 56### OH_Environment_GetUserDesktopDir() 57 58``` 59FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result) 60``` 61 62**Description** 63 64Obtains the sandbox path of the **Desktop** root directory. 65 66**Required permissions**: ohos.permission.READ_WRITE_DESKTOP_DIRECTORY 67 68**Since**: 12 69 70 71**Parameters** 72 73| Name| Description| 74| -- | -- | 75| char **result | Double pointer to the path of the **Desktop** root directory. You also need to include **malloc.h** and use **free()** to release the memory allocated.| 76 77**Returns** 78 79| Type| Description| 80| -- | -- | 81| [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode) | Returns [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode).| 82 83### OH_Environment_GetUserDocumentDir() 84 85``` 86FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result) 87``` 88 89**Description** 90 91Obtains the sandbox path of the **Document** root directory. 92 93**Required permissions**: ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY 94 95**Since**: 12 96 97 98**Parameters** 99 100| Name| Description| 101| -- | -- | 102| char **result | Double pointer to the path of the **Document** root directory. You also need to include **malloc.h** and use **free()** to release the memory allocated.| 103 104**Returns** 105 106| Type| Description| 107| -- | -- | 108| [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode) | Returns [FileManagement_ErrCode](capi-error-code-h.md#filemanagement_errcode).| 109