/[ascend]/trunk/ascend/compiler/importhandler.c
ViewVC logotype

Diff of /trunk/ascend/compiler/importhandler.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2325 by jpye, Wed Dec 15 06:35:43 2010 UTC revision 2326 by jpye, Tue Dec 21 11:35:07 2010 UTC
# Line 1  Line 1 
1  /*  ASCEND modelling environment  /*  ASCEND modelling environment
2      Copyright (C) 2006 Carnegie Mellon University      Copyright (C) 2006, 2010 Carnegie Mellon University
3    
4      This program is free software; you can redistribute it and/or modify      This program is free software; you can redistribute it and/or modify
5      it under the terms of the GNU General Public License as published by      it under the terms of the GNU General Public License as published by
# Line 391  struct FilePath *importhandler_findinpat Line 391  struct FilePath *importhandler_findinpat
391      ospath_stat_t buf;      ospath_stat_t buf;
392      FILE *f;      FILE *f;
393      const char *epath;      const char *epath;
394        char *epathmem = NULL;
395    
396      fp1 = ospath_new_noclean(partialname); /* eg 'path/to/myext' */      fp1 = ospath_new_noclean(partialname); /* eg 'path/to/myext' */
397      if(fp1==NULL){      if(fp1==NULL){
# Line 489  struct FilePath *importhandler_findinpat Line 490  struct FilePath *importhandler_findinpat
490      CONSOLE_DEBUG("SEARCHING ACCORDING TO ENV VAR $%s",envv);      CONSOLE_DEBUG("SEARCHING ACCORDING TO ENV VAR $%s",envv);
491  #endif  #endif
492    
493      int free_epath = 1;      epath = defaultpath;
494      epath=Asc_GetEnv(envv);      epathmem=Asc_GetEnv(envv);
495      if(epath==NULL){      if(epathmem){
496            epath = epathmem;
497  #ifdef FIND_DEBUG  #ifdef FIND_DEBUG
498        }else{
499          CONSOLE_DEBUG("ENV VAR '%s' NOT FOUND, FALLING BACK TO DEFAULT SEARCH PATH = '%s'",envv,defaultpath);          CONSOLE_DEBUG("ENV VAR '%s' NOT FOUND, FALLING BACK TO DEFAULT SEARCH PATH = '%s'",envv,defaultpath);
500  #endif  #endif
         epath=defaultpath;  
         free_epath = 0;  
501      }      }
502    
503  #ifdef FIND_DEBUG  #ifdef FIND_DEBUG
# Line 511  struct FilePath *importhandler_findinpat Line 512  struct FilePath *importhandler_findinpat
512          ospath_free(searchdata.relativedir);          ospath_free(searchdata.relativedir);
513          ASC_FREE(searchdata.partialname);          ASC_FREE(searchdata.partialname);
514          ospath_searchpath_free(sp);          ospath_searchpath_free(sp);
515          if(free_epath)ASC_FREE(epath);          if(epathmem)ASC_FREE(epathmem);
516          return NULL;          return NULL;
517      }      }
518    
# Line 521  struct FilePath *importhandler_findinpat Line 522  struct FilePath *importhandler_findinpat
522    
523      ospath_searchpath_free(sp);      ospath_searchpath_free(sp);
524      ASC_FREE(searchdata.partialname);      ASC_FREE(searchdata.partialname);
525      if(free_epath)ASC_FREE(epath);      if(epathmem)ASC_FREE(epathmem);
526      ospath_free(searchdata.relativedir);      ospath_free(searchdata.relativedir);
527      *handler = searchdata.handler;      *handler = searchdata.handler;
528      return searchdata.foundpath;      return searchdata.foundpath;

Legend:
Removed from v.2325  
changed lines
  Added in v.2326

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22