Environment
Overview
Provides the capability of obtaining the root directory of user files.
Since: 12
Summary
Files
| Name | Description |
|---|---|
| oh_environment.h | Defines the native APIs used to obtain the sandbox paths of the user files. |
Functions
| Name | Description |
|---|---|
| FileManagement_ErrCode OH_Environment_GetUserDownloadDir (char **result) | Obtains the sandbox path of the Download root directory. This function is available only for 2-in-1 devices. |
| FileManagement_ErrCode OH_Environment_GetUserDesktopDir (char **result) | Obtains the sandbox path of the Desktop root directory. This function is available only for 2-in-1 devices. |
| FileManagement_ErrCode OH_Environment_GetUserDocumentDir (char **result) | Obtains the sandbox path of the Documents root directory. This function is available only for 2-in-1 devices. |
Function Description
OH_Environment_GetUserDesktopDir()
FileManagement_ErrCode OH_Environment_GetUserDesktopDir (char ** result)
Description Obtains the sandbox path of the Desktop root directory.
Since: 12
Parameters
| Name | Description |
|---|---|
| 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. |
Returns
Returns FileManagement_ErrCode.
OH_Environment_GetUserDocumentDir()
FileManagement_ErrCode OH_Environment_GetUserDocumentDir (char ** result)
Description Obtains the sandbox path of the Documents root directory.
Since: 12
Parameters
| Name | Description |
|---|---|
| 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. |
Returns
Returns FileManagement_ErrCode.
OH_Environment_GetUserDownloadDir()
FileManagement_ErrCode OH_Environment_GetUserDownloadDir (char ** result)
Description Obtains the sandbox path of the Download root directory.
Since: 12
Parameters
| Name | Description |
|---|---|
| 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. |
Returns
Returns FileManagement_ErrCode.