Merge branch '4524_cleanup'
[midnight-commander.git] / src / util.c
blobbc590fb0a56075cc8b4babe5d0549e02ed237e2f
1 /*
2 Various non-library utilities
4 Copyright (C) 2003-2024
5 Free Software Foundation, Inc.
7 Written by:
8 Adam Byrtek, 2003
9 Slava Zanko <slavazanko@gmail.com>, 2013
11 This file is part of the Midnight Commander.
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.
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.
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/>.
27 #include <config.h>
29 #include "lib/global.h"
30 #include "lib/util.h"
32 #include "src/filemanager/file.h"
33 #include "src/filemanager/filegui.h"
35 #include "util.h"
37 /*** global variables ****************************************************************************/
39 /*** file scope macro definitions ****************************************************************/
41 /*** file scope type declarations ****************************************************************/
43 /*** file scope variables ************************************************************************/
45 /*** file scope functions ************************************************************************/
46 /* --------------------------------------------------------------------------------------------- */
48 /* --------------------------------------------------------------------------------------------- */
49 /*** public functions ****************************************************************************/
50 /* --------------------------------------------------------------------------------------------- */
52 gboolean
53 check_for_default (const vfs_path_t * default_file_vpath, const vfs_path_t * file_vpath)
55 if (!exist_file (vfs_path_as_str (file_vpath)))
57 file_op_context_t *ctx;
58 file_op_total_context_t *tctx;
60 if (!exist_file (vfs_path_as_str (default_file_vpath)))
61 return FALSE;
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);
72 return TRUE;
75 /* --------------------------------------------------------------------------------------------- */