Use is_dir to validate user selection.

This commit is contained in:
Ole Loots 2012-08-26 23:48:33 +02:00
parent 38c6e95f4e
commit 5a7ddb9e84
1 changed files with 3 additions and 15 deletions

View File

@ -170,21 +170,9 @@ static void __CDECL menu_save_page(WINDOW *win, int item, int title, void *data)
do {
// TODO: localize string
path = file_select( "Select folder", "" );
if( path ) {
printf("testing: %s\n", path );
// dumb check if the selection is an folder:
/*FILE * fp;
fp = fopen( path, "r" );
if( !fp ){
is_folder = true;
} else {
fclose( fp );
form_alert(1, "[1][Please select an folder or abort!][OK]");
}
*/
is_folder = true;
}
path = file_select("Select folder", "");
if (path)
is_folder = is_dir(path);
} while( !is_folder && path != NULL );
if( path != NULL ){