Changeset 1037 for trunk/src/dir_uvmat.m


Ignore:
Timestamp:
May 1, 2018, 4:31:01 PM (3 years ago)
Author:
sommeria
Message:

miscellaneous adaptations to opendap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dir_uvmat.m

    r1033 r1037  
    2727%=======================================================================
    2828
    29 function [ ListFiles] = dir_uvmat(DirName)
     29function [ ListFiles,errormsg] = dir_uvmat(DirName)
     30errormsg='';
    3031if regexp(DirName,'^http://')
    3132    catalog=[DirName,'/catalog.xml'];
     33    try
    3234    str=urlread(catalog);
    33     ListFiles=(regexp(str,'xlink:title="(?<name>[^"]+)"','names'))';
     35    catch ME
     36        ListFiles=[];
     37        errormsg=ME.message;
     38        return
     39    end
     40    ListFiles=(regexp(str,'xlink:title="(?<name>[^"]+)"','names'))';%list subfolders
    3441    NumDir=numel(ListFiles);
    35     ListFiles=[ListFiles;(regexp(str,'dataset name="(?<name>[^"]+)"','names'))'];
     42    ListFiles=[ListFiles;(regexp(str,'dataset name="(?<name>[^"]+)"','names'))'];% append files to the list
    3643    for ilist=1:numel(ListFiles)
    3744        ListFiles(ilist).date=0;
     
    4350        ListFiles(ilist).isdir=true;
    4451    end
     52    ListFiles(NumDir+1)=[];
    4553else
    4654    ListFiles=dir(DirName);
Note: See TracChangeset for help on using the changeset viewer.