Changeset 7452


Ignore:
Timestamp:
12/22/10 17:01:49 (9 years ago)
Author:
melissa
Message:

Fixed .nd/.stk file searching, to prevent problems with multiple similarly-named datasets in the same directory. See  omero:#3708.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r7287 r7452  
    255255        stkFile = stkFile.substring(stkFile.lastIndexOf(File.separator) + 1); 
    256256      } 
    257       String parentPath = id.substring(0, id.lastIndexOf(File.separator) + 1); 
    258       Location parent = new Location(parentPath).getAbsoluteFile(); 
     257      Location parent = new Location(id).getAbsoluteFile().getParentFile(); 
    259258      LOGGER.info("Looking for STK file in {}", parent.getAbsolutePath()); 
    260259      String[] dirList = parent.list(true); 
     
    265264        String prefix = f.substring(0, underscore); 
    266265 
    267         if ((f.indexOf(stkFile) != -1 || stkFile.startsWith(prefix)) && 
     266        if ((f.equals(stkFile) || stkFile.startsWith(prefix)) && 
    268267          checkSuffix(f, STK_SUFFIX)) 
    269268        { 
     
    292291      String stkPrefix = stkName; 
    293292      if (stkPrefix.indexOf("_") >= 0) { 
    294         stkPrefix = stkPrefix.substring(0, stkPrefix.indexOf("_")); 
     293        stkPrefix = stkPrefix.substring(0, stkPrefix.indexOf("_") + 1); 
    295294      } 
    296295      Location parent = stk.getParentFile(); 
     
    299298        if (checkSuffix(f, ND_SUFFIX)) { 
    300299          String prefix = f.substring(0, f.lastIndexOf(".")); 
    301           if (stkName.startsWith(prefix) || prefix.startsWith(stkPrefix)) { 
     300          if (stkName.startsWith(prefix) || prefix.equals(stkPrefix)) { 
    302301            ndfile = new Location(parent, f).getAbsoluteFile(); 
    303302            break; 
Note: See TracChangeset for help on using the changeset viewer.