Ignore:
Timestamp:
Apr 15, 2014, 9:06:46 AM (10 years ago)
Author:
sommeria
Message:

bugs corrected in browse_data and mouse_motion (z display)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r733 r741  
    7272set(hObject, 'Units', OldUnits);
    7373if exist('Campaign','var')
    74     [CampaignPath,CampaignName]=fileparts(Campaign);
     74    [tild,CampaignName]=fileparts(Campaign);
    7575    RootXml=fullfile(Campaign,[CampaignName '.xml']);
    7676    s=[];
     
    125125    if isempty(MirrorRoot)
    126126        return
     127    elseif strcmp(MirrorRoot,SourcePath)
     128        msgbox_uvmat('ERROR','The mirror folder must be different from the source')
     129        return
    127130    else
    128131        MirrorDir=fullfile(MirrorRoot,ProjectName);
    129132    end
    130     if ~exist(MirrorDir,'dir')
    131         mkdir(MirrorDir)
     133    if exist(MirrorDir,'dir')
     134        msgbox_uvmat('ERROR',['The folder ' MirrorDir ' chosen as new mirror campaign already exists'])
     135        return
     136    else
     137        [s,errormsg]=mkdir(MirrorDir)% create the mirror dir
     138        if s~=1
     139            msgbox_uvmat('ERROR',['error in creating ' MirrorDir ': ' errormsg])
     140            return
     141        end
    132142    end
    133143    MirrorDoc.SourceDir=SourceDir;
    134144    t=struct2xml(MirrorDoc);
    135145    set(t,1,'name','DataTree');
    136     save(t,fullfile(MirrorDir,[ProjectName '.xml']))
     146    save(t,fullfile(MirrorDir,[ProjectName '.xml']))% create an xml file in the mirror folder to indicate its source folder
    137147    set(handles.MirrorDir,'String',MirrorDir)
    138148    set(handles.MirrorDir,'Visible','on')
     149    set(handles.CreateMirror,'String','update_mirror')
    139150end
    140151ExpName={''};
     
    206217 function ListExperiments_Callback(hObject, eventdata, handles)
    207218
    208 MirrorPath='';
    209 CampaignPath=get(handles.SourceDir,'String');
    210219if strcmp(get(handles.MirrorDir,'Visible'),'on')
    211220    MirrorPath=get(handles.MirrorDir,'String');
     221else
     222    MirrorPath=get(handles.SourceDir,'String');
    212223end
    213224ListExperiments=get(handles.ListExperiments,'String');
     
    229240for iexp=1:numel(ListExperiments)
    230241    if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory
    231         ListExperiments{iexp}(1)=[];
     242        ListExperiments{iexp}(1)=[];%remove the first char '+' used to mark folders
    232243        ListStruct=dir(fullfile(MirrorPath,ListExperiments{iexp})); %list files and dir in the source experiment directory
    233244        ListCells=struct2cell(ListStruct);%transform dir struct to a cell arrray
     
    279290                if ~isempty(MirrorPath)
    280291                    mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist});
    281                     if exist(mirror,'dir')||exist(mirror,'file')
     292                    if exist(mirror,'file')% if mirror already exists as a file or folder
    282293                        [tild,msg]=fileattrib(mirror);
    283294                        if strcmp(msg.Name,mirror)%if the mirror name already exists as a local file or dir
    284                             if msg.directory% case of a f
     295                            if msg.directory% case of a folder
    285296                                answer=msgbox_uvmat('INPUT_Y-N',['replace local folder ' msg.Name ' by a link to the source dir']);
    286297                                if strcmp(answer,'Yes')
     
    292303                                    end
    293304                                end
    294                             else
     305                            else % case of an existing mirror file
    295306                                answer=msgbox_uvmat('INPUT_Y-N',['replace local file ' msg.Name ' by a link to the source file']);
    296307                                if strcmp(answer,'Yes')
    297308                                    delete(mirror);
    298                                     system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder
    299                                    
     309                                    system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder                                 
    300310                                end
    301311                            end
    302                         else% create mirror to the data series if needed
    303                             system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder
    304312                        end
     313                    else% create mirror to the data series if needed
     314                        system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder                     
    305315                    end
    306316                    if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices
     
    586596Device=Device(Value);
    587597Device=regexprep(Device,'^\+/','');% remove the +/ used to mark dir
     598Device=regexprep(Device,'^~','');% remove the ~ used to mark symbolic link
    588599handles.output.Experiment=Experiment;
    589600handles.output.DataSeries=Device;
Note: See TracChangeset for help on using the changeset viewer.