ita_toolbox_license.m 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
%% Show the license and its location;

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved. 
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. 
% </ITA-Toolbox>


fid = fopen([ita_toolbox_path filesep 'license.txt']);
funcTemplate = fread(fid, 'uint8=>char')';
disp(funcTemplate(1:end-1))
fclose(fid);
fprintf(2,'********************************************************************************\n')
14
disp(['*** The license can be found at ' ita_toolbox_path filesep 'license.txt ***' ])
15 16 17 18 19
fprintf(2,'********************************************************************************\n')

%% ask
if usejava('desktop') %Only if jvm available (non_cluster)
    commandwindow();
20
    choice = questdlg('Do you agree to the terms of the license agreement? The complete licnese ("license.txt") can be found in the root directory of the ITA-Toolbox.','License Agreement - ITA-Toolbox:', ...
21 22 23 24 25 26 27 28 29 30 31
        'Yes','No','No');
    switch lower(choice)
        case 'yes'
            fprintf(2,'You have agreed to the license agreement of ITA-Toolbox for MATLAB\n');
        case 'no'
            fprintf(2,'You have NOT agreed to the license agreement of ITA-Toolbox for MATLAB\n');
            error('License Agreement not accepted.')
    end
end

%% set accepted flag in preferences
32
ita_preferences('license',true);