Example #1
0
void ED_file_change_dir(bContext *C, const bool checkdir)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	SpaceFile *sfile = CTX_wm_space_file(C);

	if (sfile->params) {
		ED_fileselect_clear(wm, sfile);

		/* Clear search string, it is very rare to want to keep that filter while changing dir,
		 * and usually very annoying to keep it actually! */
		sfile->params->filter_search[0] = '\0';

		if (checkdir && !BLI_is_dir(sfile->params->dir)) {
			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
			/* could return but just refresh the current dir */
		}
		filelist_setdir(sfile->files, sfile->params->dir);
		/* clear selected file to avoid trying to open it from the new dir with changed path */
		sfile->params->file[0] = '\0';
		sfile->params->active_file = -1;
		
		if (folderlist_clear_next(sfile))
			folderlist_free(sfile->folders_next);

		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);

		file_draw_check(C);
	}
}
Example #2
0
void file_change_dir(struct SpaceFile *sfile, int checkdir)
{
	if (sfile->params) {

		if(checkdir && BLI_is_dir(sfile->params->dir)==0) {
			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
			/* could return but just refresh the current dir */
		}

		filelist_setdir(sfile->files, sfile->params->dir);

		if(folderlist_clear_next(sfile))
			folderlist_free(sfile->folders_next);

		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);

		filelist_free(sfile->files);
		sfile->params->active_file = -1;
	}
}
Example #3
0
void file_change_dir(bContext *C, int checkdir)
{
	SpaceFile *sfile= CTX_wm_space_file(C);

	if (sfile->params) {

		ED_fileselect_clear(C, sfile);

		if(checkdir && BLI_is_dir(sfile->params->dir)==0) {
			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
			/* could return but just refresh the current dir */
		}
		filelist_setdir(sfile->files, sfile->params->dir);
		
		if(folderlist_clear_next(sfile))
			folderlist_free(sfile->folders_next);

		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);

	}
}
Example #4
0
void file_change_dir(bContext *C, int checkdir)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	SpaceFile *sfile = CTX_wm_space_file(C);

	if (sfile->params) {

		ED_fileselect_clear(wm, sfile);

		if (checkdir && !BLI_is_dir(sfile->params->dir)) {
			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
			/* could return but just refresh the current dir */
		}
		filelist_setdir(sfile->files, sfile->params->dir);
		
		if (folderlist_clear_next(sfile))
			folderlist_free(sfile->folders_next);

		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);

		file_draw_check_cb(C, NULL, NULL);
	}
}