Ejemplo n.º 1
0
void
vifm_try_leave(int write_info, int cquit, int force)
{
	if(!force && bg_has_active_jobs())
	{
		if(!prompt_msg("Warning", "Some of backgrounded commands are still "
					"working.  Quit?"))
		{
			return;
		}
	}

	fuse_unmount_all();

	if(write_info)
	{
		write_info_file();
	}

	if(stats_file_choose_action_set())
	{
		vim_write_empty_file_list();
	}
#ifdef _WIN32
	erase();
	refresh();
#endif
	ui_shutdown();

	vifm_leave(EXIT_SUCCESS, cquit);
}
Ejemplo n.º 2
0
static void
handle_file(FileView *view, FileHandleExec exec, FileHandleLink follow)
{
	char full_path[PATH_MAX];
	int executable;
	int runnable;
	const dir_entry_t *const curr = &view->dir_entry[view->list_pos];

	get_full_path_of(curr, sizeof(full_path), full_path);

	if(is_dir(full_path) || is_unc_root(view->curr_dir))
	{
		if(!curr->selected && (curr->type != FT_LINK || follow == FHL_NO_FOLLOW))
		{
			open_dir(view);
			return;
		}
	}

	runnable = is_runnable(view, full_path, curr->type, follow == FHL_FOLLOW);
	executable = is_executable(full_path, curr, exec == FHE_NO_RUN, runnable);

	if(stats_file_choose_action_set() && (executable || runnable))
	{
		/* The call below does not return. */
		vifm_choose_files(view, 0, NULL);
	}

	if(executable && !is_dir_entry(full_path, curr->type))
	{
		execute_file(full_path, exec == FHE_ELEVATE_AND_RUN);
	}
	else if(runnable)
	{
		run_selection(view, exec == FHE_NO_RUN);
	}
	else if(curr->type == FT_LINK)
	{
		follow_link(view, follow == FHL_FOLLOW);
	}
}