1 /* 2 Various non-library utilities 3 4 Copyright (C) 2003-2024 5 Free Software Foundation, Inc. 6 7 Written by: 8 Adam Byrtek, 2003 9 Slava Zanko <slavazanko@gmail.com>, 2013 10 11 This file is part of the Midnight Commander. 12 13 The Midnight Commander is free software: you can redistribute it 14 and/or modify it under the terms of the GNU General Public License as 15 published by the Free Software Foundation, either version 3 of the License, 16 or (at your option) any later version. 17 18 The Midnight Commander is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 #include <config.h> 28 29 #include "lib/global.h" 30 #include "lib/util.h" 31 32 #include "src/filemanager/file.h" 33 #include "src/filemanager/filegui.h" 34 35 #include "util.h" 36 37 /*** global variables ****************************************************************************/ 38 39 /*** file scope macro definitions ****************************************************************/ 40 41 /*** file scope type declarations ****************************************************************/ 42 43 /*** file scope variables ************************************************************************/ 44 45 /*** file scope functions ************************************************************************/ 46 /* --------------------------------------------------------------------------------------------- */ 47 48 /* --------------------------------------------------------------------------------------------- */ 49 /*** public functions ****************************************************************************/ 50 /* --------------------------------------------------------------------------------------------- */ 51 52 gboolean 53 check_for_default (const vfs_path_t *default_file_vpath, const vfs_path_t *file_vpath) /* */ 54 { 55 if (!exist_file (vfs_path_as_str (file_vpath))) 56 { 57 file_op_context_t *ctx; 58 file_op_total_context_t *tctx; 59 60 if (!exist_file (vfs_path_as_str (default_file_vpath))) 61 return FALSE; 62 63 ctx = file_op_context_new (OP_COPY); 64 tctx = file_op_total_context_new (); 65 file_op_context_create_ui (ctx, 0, FALSE); 66 copy_file_file (tctx, ctx, vfs_path_as_str (default_file_vpath), 67 vfs_path_as_str (file_vpath)); 68 file_op_total_context_destroy (tctx); 69 file_op_context_destroy (ctx); 70 } 71 72 return TRUE; 73 } 74 75 /* --------------------------------------------------------------------------------------------- */