uninstall_LUKE

PURPOSE ^

SYNOPSIS ^

function uninstall_LUKE(pathforstartup)

DESCRIPTION ^

Uninstall LUKE path in existing default MatLab startup.m, and remove all
*.mat and *.mex files

By Joan Decker (CEA-DRFC, joan.decker@cea.fr) and Yves Peysson (CEA-DRFC, yves.peysson@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function uninstall_LUKE(pathforstartup)
0002 %
0003 %Uninstall LUKE path in existing default MatLab startup.m, and remove all
0004 %*.mat and *.mex files
0005 %
0006 %By Joan Decker (CEA-DRFC, joan.decker@cea.fr) and Yves Peysson (CEA-DRFC, yves.peysson@cea.fr)
0007 %
0008 %
0009 if nargin == 0,
0010     pathforstartup = which('startup.m');%The default directory for startup.m is the same as the always existing startup.m file
0011     %
0012     if isempty(pathforstartup),
0013         fid = -2;
0014     else
0015         fid = fopen(pathforstartup,'r');  
0016     end
0017     %
0018     if fid <= -1,
0019         if fid == -2,
0020             disp(['No startup.m found in path']);
0021         else
0022             disp(['Cannot write to startup.m, no permission.']);
0023         end
0024         disp(['Looking for a startup.m file in home or pathdef.m directory.']);
0025         %
0026         if strcmp(computer,'PCWIN'),
0027             pathforstartup = which('pathdef.m');%The default directory for startup.m is the same as the always existing startup.m file
0028             pathforstartup = pathforstartup([1:findstr(pathforstartup,'pathdef.m')-1]);
0029         else
0030             pathforstartup = '~/';%The default directory for startup.m is the same as the always existing startup.m file
0031         end
0032         %
0033     else
0034         pathforstartup = pathforstartup([1:findstr(pathforstartup,'startup.m')-1]);
0035         fclose(fid);
0036     end    
0037     %
0038 end
0039 %
0040 if strcmp(pathforstartup(end),'/');
0041     startuppath = [pathforstartup,'startup.m'];
0042 else
0043     startuppath = [pathforstartup,'/startup.m'];
0044 end
0045 %
0046 if exist(startuppath),%startup.m file exists
0047     flag = 0;
0048     fid = fopen(startuppath,'r');  
0049     sfile = fread(fid);
0050     %
0051     sf1 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%BEGIN-LUKE-PATH%%%%%%%%%%%%%%%%%%%');
0052     sf2 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%%END-LUKE-PATH%%%%%%%%%%%%%%%%%%%%');
0053     while length(sf1)>0
0054         sfile = sfile([1:max(1,sf1(1)-1),sf2(1)+53:length(sfile)]);
0055         sf1 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%BEGIN-LUKE-PATH%%%%%%%%%%%%%%%%%%%');
0056         sf2 = strfind(char(sfile'),'%%%%%%%%%%%%%%%%%%%%END-LUKE-PATH%%%%%%%%%%%%%%%%%%%%');
0057     end
0058     fclose(fid);
0059     fid = fopen(startuppath,'w');  
0060     fwrite(fid,sfile);
0061     fclose(fid); 
0062 end
0063 %
0064 disp(['The startup.m file has been cleaned from LUKE path']);
0065 %
0066 path_LUKE = [pwd,'/'];
0067 %
0068 % Remove *.mat and *.mex files if possible
0069 %
0070 mex_clean_luke(path_LUKE)
0071 %
0072 cd([path_LUKE,'Project_DKE/Database']);
0073 remove_all;
0074 cd(path_LUKE);
0075 %
0076 % Remove html documentation
0077 %
0078 if exist('Documentation') == 7,
0079     rmdir('Documentation','s');
0080     disp(['The Documentation folder has been removed.']);
0081 end
0082 %
0083 % Remove paths
0084 %
0085 setpath_luke_jd
0086 %
0087 disp(['The LUKE paths have been removed.']);
0088 
0089 
0090 
0091 
0092 
0093

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.