/* If not copy the default */ static int check_for_default(char *default_file, char *file) { struct stat s; off_t count = 0; double bytes = 0; FileOpContext *ctx; if (mc_stat (file, &s)){ if (mc_stat (default_file, &s)){ return -1; } ctx = file_op_context_new (OP_COPY); file_op_context_create_ui (ctx, 0); copy_file_file (ctx, default_file, file, 1, &count, &bytes, 1); file_op_context_destroy (ctx); } return 0; }
int check_for_default (const char *default_file, const char *file) { if (!exist_file (file)) { FileOpContext *ctx; FileOpTotalContext *tctx; if (!exist_file (default_file)) return -1; ctx = file_op_context_new (OP_COPY); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, 0, FALSE); copy_file_file (tctx, ctx, default_file, file); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); } return 0; }
gboolean check_for_default (const vfs_path_t * default_file_vpath, const vfs_path_t * file_vpath) { if (!exist_file (vfs_path_as_str (file_vpath))) { file_op_context_t *ctx; file_op_total_context_t *tctx; if (!exist_file (vfs_path_as_str (default_file_vpath))) return FALSE; ctx = file_op_context_new (OP_COPY); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, 0, FALSE); copy_file_file (tctx, ctx, vfs_path_as_str (default_file_vpath), vfs_path_as_str (file_vpath)); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); } return TRUE; }