function new_path = MBARI_path(old_path, force_computer) % function new_path = MBARI_path(old_path, force_computer) % Takes a pc or unix path, and adjusts it for the local environment % Adjusts for peculiarities of tornado and tempest Network % Appliance file servers % force_computer can be set to 'PCWIN' or 'GLNX86' to run % the function as if it were being run on the given machine % % for example, on a pc, the path will look like: % //tornado/Diatom/CIMT/Configuration/OCR3000 % or //foo/bardir/etc % on most unix boxes, the path will become: % /hosts/tornado/vol/vol0/Diatom/CIMT/Configuration/OCR3000 % or /hosts/foo/bardir/etc % on linux boxes, the path will become: % /hosts/tornado/Diatom/CIMT/Configuration/OCR3000 % or /hosts/foo/bardir/etc % % Created 05/26/2004 % by Michael Godin % if(nargin < 2) force_computer = computer; end comp = force_computer; % Turn '\'s into '/'s old_path = strrep(old_path,'\','/'); host = ''; if(strncmp(old_path,'//',2) || strncmp(old_path,'/hosts/',7)), % Stip off leading double slash if this a pc file old_path = strrep(old_path,'//',''); % Stip off '/hosts/' if this a unix file old_path = strrep(old_path,'/hosts/',''); % Separate off the host name [host, old_path] = strtok(old_path, '/'); % get rid of 'vol/vol0/ if(strncmp(old_path, '/vol/vol0', 9)), old_path = old_path(10:end); end end % Rebuild % special syntax for PCs if(strncmp(comp,'PC',2)), % is this the special case of data/AOSNII on Mammoth? if (strcmpi(host,'mammoth') ... && strncmpi(old_path,'/data/AOSNII', 12) ), old_path = ['/aosnii' old_path(13:end)]; host = 'polarbear'; end if(isempty(host)) new_path = old_path; else new_path = ['//' host old_path]; end % is this a non-NFS share, or any volume on Linux? elseif(strcmp(comp,'GLNX86') || strcmp(comp,'LNX86')... || (~strcmp(host,'tornado') && ~strcmp(host,'tempest'))), % are we on the host itself? if (strcmp(getenv('HOSTNAME'),host)), host=''; end % is this the special case of ssdsdata on Mammoth? toTornadoOnMammoth = strcmp(getenv('HOSTNAME'),'mammoth') ... && strcmp(host, 'tornado'); if (toTornadoOnMammoth ... && strncmp(old_path,'/vol/vol0/ssdsdata', 18)), new_path = old_path(10:end); elseif (toTornadoOnMammoth ... && strncmp(old_path,'/ssdsdata', 9)), new_path = old_path; else if(isempty(host)) new_path = old_path; else new_path = ['/hosts/' host old_path]; end end % this is a NSF volume on a non-linux machine else % are we on the host itself? if (strcmp(getenv('HOSTNAME'),host)), host=''; end if(isempty(host)) new_path = ['old_path']; else new_path = ['/hosts/' host '/vol/vol0' old_path]; end end