15bebb993Sopenharmony_ci/* 25bebb993Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 35bebb993Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 45bebb993Sopenharmony_ci * you may not use this file except in compliance with the License. 55bebb993Sopenharmony_ci * You may obtain a copy of the License at 65bebb993Sopenharmony_ci * 75bebb993Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 85bebb993Sopenharmony_ci * 95bebb993Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 105bebb993Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 115bebb993Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125bebb993Sopenharmony_ci * See the License for the specific language governing permissions and 135bebb993Sopenharmony_ci * limitations under the License. 145bebb993Sopenharmony_ci */ 155bebb993Sopenharmony_ci 165bebb993Sopenharmony_ci#include "environment.h" 175bebb993Sopenharmony_ci 185bebb993Sopenharmony_ci#include <stdio.h> 195bebb993Sopenharmony_ci 205bebb993Sopenharmony_ci#include "environment_native.h" 215bebb993Sopenharmony_ci#include "../common/error_code.h" 225bebb993Sopenharmony_ci 235bebb993Sopenharmony_ciint OH_Environment_GetUserDownloadDir(char **result) 245bebb993Sopenharmony_ci{ 255bebb993Sopenharmony_ci if (result == NULL) { 265bebb993Sopenharmony_ci return GetErrorCode(-PARAMETER_ERROR); 275bebb993Sopenharmony_ci } 285bebb993Sopenharmony_ci int ret = GetUserDir("/Download", result); 295bebb993Sopenharmony_ci if (ret < 0) { 305bebb993Sopenharmony_ci return GetErrorCode(ret); 315bebb993Sopenharmony_ci } 325bebb993Sopenharmony_ci return ret; 335bebb993Sopenharmony_ci} 345bebb993Sopenharmony_ci 355bebb993Sopenharmony_ciint OH_Environment_GetUserDocumentDir(char **result) 365bebb993Sopenharmony_ci{ 375bebb993Sopenharmony_ci if (result == NULL) { 385bebb993Sopenharmony_ci return GetErrorCode(-PARAMETER_ERROR); 395bebb993Sopenharmony_ci } 405bebb993Sopenharmony_ci int ret = GetUserDir("/Documents", result); 415bebb993Sopenharmony_ci if (ret < 0) { 425bebb993Sopenharmony_ci return GetErrorCode(ret); 435bebb993Sopenharmony_ci } 445bebb993Sopenharmony_ci return ret; 455bebb993Sopenharmony_ci} 465bebb993Sopenharmony_ci 475bebb993Sopenharmony_ciint OH_Environment_GetUserDesktopDir(char **result) 485bebb993Sopenharmony_ci{ 495bebb993Sopenharmony_ci if (result == NULL) { 505bebb993Sopenharmony_ci return GetErrorCode(-PARAMETER_ERROR); 515bebb993Sopenharmony_ci } 525bebb993Sopenharmony_ci int ret = GetUserDir("/Desktop", result); 535bebb993Sopenharmony_ci if (ret < 0) { 545bebb993Sopenharmony_ci return GetErrorCode(ret); 555bebb993Sopenharmony_ci } 565bebb993Sopenharmony_ci return ret; 575bebb993Sopenharmony_ci} 58