Changeset 8363

Show
Ignore:
Timestamp:
04/02/12 16:28:09 (4 months ago)
Author:
westram
Message:
  • property file loading
    • missing fallback for 'Save loaded Properties' when no saved properties existed yet
    • GB_login now always prints full-path of loaded properties to console
Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/ARBDB/ad_load.cxx

    r8319 r8363  
    13581358     * - 's'     read only ??? 
    13591359     * - 'D' looks for default in $ARBHOME/lib/arb_default if file is not found in ~/.arb_prop 
    1360      *       (only work combined with mode 'c')  
     1360     *       (only works combined with mode 'c')  
    13611361     * - memory usage: 
    13621362     *   - 't' small memory usage 
     
    15161516                        } 
    15171517                        else { 
    1518                             fprintf(stderr, "Using properties from '%s'\n", found_path); 
    15191518                            freeset(path, found_path); 
    15201519                            input = fopen(path, "rb"); 
     
    15331532            } 
    15341533            if (input) { 
     1534                if (strchr(opent, 'D')) { // we are loading properties -> be verboose 
     1535                    fprintf(stderr, "Using properties from '%s'\n", path); 
     1536                } 
    15351537                time_of_main_file = GB_time_of_file(path); 
    15361538 
  • trunk/EDIT4/ED4_main.cxx

    r8313 r8363  
    460460    e4_assert(mode >= 0 && mode <= 2); 
    461461 
    462     if (mode == 2) return "edit4.arb"; 
    463  
    464     static char *ali_name = 0; 
    465     static char *ali_type = 0; 
    466     static char *result = 0; 
    467  
    468     if (!ali_name) { 
    469         GB_transaction dummy(GLOBAL_gb_main); 
    470         ali_name = GBT_get_default_alignment(GLOBAL_gb_main); 
    471         ali_type = GBT_get_alignment_type_string(GLOBAL_gb_main, ali_name); 
    472         result   = new char[21+strlen(ali_name)]; 
    473     } 
    474  
    475     sprintf(result, "edit4_%s.arb", mode == 0 ? ali_name : ali_type); 
     462    const char *result; 
     463    if (mode == 2) { 
     464        result = "edit4.arb"; 
     465    } 
     466    else { 
     467        static char *ali_name = 0; 
     468        static char *ali_type = 0; 
     469        static char *result_copy = 0; 
     470 
     471        if (!ali_name) { 
     472            GB_transaction dummy(GLOBAL_gb_main); 
     473            ali_name = GBT_get_default_alignment(GLOBAL_gb_main); 
     474            ali_type = GBT_get_alignment_type_string(GLOBAL_gb_main, ali_name); 
     475            result_copy   = new char[21+strlen(ali_name)]; 
     476        } 
     477 
     478        sprintf(result_copy, "edit4_%s.arb", mode == 0 ? ali_name : ali_type); 
     479        result = result_copy; 
     480    } 
    476481 
    477482    return result; 
  • trunk/EDIT4/ED4_root.cxx

    r8360 r8363  
    15601560            } 
    15611561        } 
    1562         e4_assert(default_mode != -1); 
     1562        if (default_mode == -1) default_mode = 2; // no properties yet -> use 'edit4.arb' 
    15631563 
    15641564        const char *entry = GBS_global_string("Save loaded Properties (%s)", ED4_propertyName(default_mode)); 
     
    18731873    // if not, use 'mode 2', i.e. "edit4.arb" 
    18741874    // (no full path, we want to load default from arb_defaults) 
    1875     if (!propname) { 
    1876         freedup(propname, ED4_propertyName(2)); 
    1877     } 
    1878  
    1879     GB_informationf("Using properties from '%s'", propname); 
     1875    if (!propname) propname = strdup(ED4_propertyName(2)); 
     1876 
    18801877    return propname; 
    18811878}