openharmony 鸿蒙 capi-oh-environment-h

2026-08-25 浏览 (1)

oh_environment.h

Overview

Defines the native APIs used to obtain the sandbox paths of the user files.

Header file: <filemanagement/environment/oh_environment.h>

Library: libohenvironment.so

System capability: SystemCapability.FileManagement.File.Environment.FolderObtain

Since: 12

Related module: Environment

Summary

Functions

NameDescription
FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result)Obtains the sandbox path of the Download root directory.
FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result)Obtains the sandbox path of the Desktop root directory.
FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result)Obtains the sandbox path of the Document root directory.

Function Description

OH_Environment_GetUserDownloadDir()

FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result)

Description

Obtains the sandbox path of the Download root directory.

Since: 12

Parameters

NameDescription
char **resultDouble pointer to the path of the Download root directory. You also need to include malloc.h and use free() to release the memory allocated.

Returns

TypeDescription
FileManagement_ErrCodeReturns FileManagement_ErrCode.

OH_Environment_GetUserDesktopDir()

FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result)

Description

Obtains the sandbox path of the Desktop root directory.

Since: 12

Parameters

NameDescription
char **resultDouble pointer to the path of the Desktop root directory. You also need to include malloc.h and use free() to release the memory allocated.

Returns

TypeDescription
FileManagement_ErrCodeReturns FileManagement_ErrCode.

OH_Environment_GetUserDocumentDir()

FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result)

Description

Obtains the sandbox path of the Document root directory.

Since: 12

Parameters

NameDescription
char **resultDouble pointer to the path of the Document root directory. You also need to include malloc.h and use free() to release the memory allocated.

Returns

TypeDescription
FileManagement_ErrCodeReturns FileManagement_ErrCode.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-file-environment-sys

openharmony 鸿蒙 js-apis-file-fs

openharmony 鸿蒙 capi-clouddisk-clouddisk-pathinfo

openharmony 鸿蒙 capi-clouddisk-clouddisk-changesresult

openharmony 鸿蒙 capi-clouddisk-clouddisk-syncfolder

openharmony 鸿蒙 js-apis-fileShare

openharmony 鸿蒙 capi-fileio

openharmony 鸿蒙 js-apis-file-storage-statistics-sys

openharmony 鸿蒙 js-apis-file-cloudsyncmanager

openharmony 鸿蒙 js-apis-file-environment

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/7JedtmMk