From: curt Date: Fri, 21 Jan 2005 23:23:29 +0000 (+0000) Subject: Updated to handle scenery files with a .tgz extension. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=453e3963d9937a73387f645c3b09fd8d42ed2631;p=flightgear.git Updated to handle scenery files with a .tgz extension. --- diff --git a/utils/fgadmin/src/fgadmin_funcs.cxx b/utils/fgadmin/src/fgadmin_funcs.cxx index ea8de12d8..4fbf0c938 100644 --- a/utils/fgadmin/src/fgadmin_funcs.cxx +++ b/utils/fgadmin/src/fgadmin_funcs.cxx @@ -151,7 +151,7 @@ void FGAdminUI::update_install_box() { char base[FL_PATH_MAX]; strncpy( base, ent->d_name, FL_PATH_MAX ); const char *p = fl_filename_ext( base ); - int offset; + int offset, expected_length = 0; if ( strcmp( p, ".gz" ) == 0 ) { offset = p - base; base[offset] = '\0'; @@ -159,13 +159,19 @@ void FGAdminUI::update_install_box() { if ( strcmp( p, ".tar" ) == 0 ) { offset = p - base; base[offset] = '\0'; + expected_length = 14; } + } else if ( strcmp( p, ".tgz" ) == 0 ) { + offset = p - base; + base[offset] = '\0'; + expected_length = 11; } else if ( strcmp( p, ".zip" ) == 0 ) { offset = p - base; base[offset] = '\0'; + expected_length = 11; } - if ( strlen(ent->d_name) != 14 ) { + if ( strlen(ent->d_name) != expected_length ) { // simple heuristic to ignore non-scenery files } else if ( ent->d_name[0] != 'e' && ent->d_name[0] != 'w' ) { // further sanity checks on name