Changeset 20377


Ignore:
Timestamp:
03/29/16 11:37:11 (9 years ago)
Author:
Mathieu Morlighem
Message:

NEW: figure out what ISSM_DIR is based on path name rather than forcing users to edit their bashrc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/os/issmdir.m

    r13170 r20377  
    55%      ISSM_DIR=issmdir()
    66
    7 if ~ispc(),
    8         ISSM_DIR =getenv('ISSM_DIR');
     7%Initialize output ISSM_DIR
     8ISSM_DIR='';
     9
     10%Get ISSM_DIR from function path (we do not want to force users to edit their bashrc)
     11path=which('issmdir');
     12
     13%issmdir might be in bin,
     14pos=strfind(path,'bin/issmdir.m');
     15if ~isempty(pos),
     16        ISSM_DIR=path(1:pos-1);
    917else
    10         ISSM_DIR =getenv('ISSM_DIR_WIN');
    11         if strcmpi(ISSM_DIR(end),'/') | strcmpi(ISSM_DIR(end),'\'),
    12                 ISSM_DIR = ISSM_DIR(1:end-1); %shave off the last '/'
     18        pos=strfind(path,'src/m/os/issmdir.m');
     19        if ~isempty(pos),
     20                ISSM_DIR=path(1:pos-1);
    1321        end
    1422end
    1523
    16 if (isempty(ISSM_DIR)),
    17         error('issmdir error message: ''ISSM_DIR'' environment variable is empty! You should define ISSM_DIR in your .cshrc or .bashrc!');
     24if isempty(ISSM_DIR),
     25        error('Could not determine the location of ISSM...');
    1826end
Note: See TracChangeset for help on using the changeset viewer.