4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jungki Kwak <jungki.kwak@samsung.com>, Keunsoon Lee <keunsoon.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * @file download-agent-file.h
22 * @author Keunsoon Lee(keunsoon.lee@samsung.com)
25 #ifndef _Download_Agent_File_H
26 #define _Download_Agent_File_H
29 #include <sys/types.h>
32 #include "download-agent-type.h"
33 #include "download-agent-dl-mgr.h"
36 #define DA_DEFAULT_TMP_FILE_DIR_PATH "/opt/media/.tmp_download"
38 // FIXME Later : temporary code
39 #define DA_DEFAULT_TMP_FILE_DIR_PATH "/tmp/.tmp_download"
42 da_bool_t is_file_exist(const char *file_path);
43 da_bool_t is_dir_exist(char *dir_path);
45 void get_file_size(char *file_path, int *out_file_size);
47 da_result_t clean_files_from_dir(char* dir_path);
48 da_result_t create_temp_saved_dir(void);
50 da_result_t file_write_ongoing(stage_info *stage, char *body, int body_len);
51 da_result_t file_write_complete(stage_info *stage);
52 da_result_t start_file_writing(stage_info *stage);
53 da_result_t start_file_writing_append(stage_info *stage);
55 da_result_t get_mime_type(stage_info *stage, char **out_mime_type);
56 da_result_t discard_download(stage_info *stage) ;
57 void clean_paused_file(stage_info *stage);
58 da_result_t replace_content_file_in_stage(stage_info *stage, const char *dest_dd_file_path);
59 da_result_t decide_final_file_path(stage_info *stage);
60 char *get_full_path_avoided_duplication(char *in_dir, char *in_candidate_file_name, char * in_extension);
62 da_result_t copy_file(const char *src, const char *dest);
63 da_result_t create_dir(const char *install_dir);