diff m-toolbox/classes/@LTPDAprefs/loadPrefs.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children 4be5f7a5316f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@LTPDAprefs/loadPrefs.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,37 @@
+% LOADPREFS a static method which loads the preferences from a XML file.
+%
+% Call:        LTPDAprefs.loadPrefs()
+%
+% Parameters:
+%        -
+%
+% Version:
+%     $Id: loadPrefs.m,v 1.3 2011/04/27 12:45:49 hewitson Exp $
+%
+
+function loadPrefs(varargin)
+  fprintf('Loading LTPDA preferences from %s ...\n', LTPDAprefs.preffile);
+  v = ver('LTPDA');
+  nv = utils.helper.ver2num(v(1).Version);
+  prefs = mpipeline.ltpdapreferences.LTPDAPreferences.loadFromDisk(LTPDAprefs.preffile, nv);
+  
+  % Version 2.4 drops support for built-in model directories.
+  if (nv >= 2.04) 
+    % we drop support for 'models' here, so check for non-empty models path
+    % and warn the user to make an extension
+    searchPaths = prefs.getModelsPrefs.getSearchPaths;
+    paths = {};
+    for kk=0:searchPaths.size-1
+      paths = [paths {char(searchPaths.get(kk))}];
+    end    
+    if ~isempty(paths)
+      message = sprintf('Directories of built-in models are no longer supported. \nPlease make an LTPDA Extension module for your models. \n(See document section "LTPDA Extension Modules").\n');
+      utils.helper.warnDlg(message, 'Built-in model directories not supported');
+      prefs.getModelsPrefs.getSearchPaths.clear();
+    end
+  end
+    
+  setappdata(0, 'LTPDApreferences', prefs);
+  LTPDAprefs.setApplicationData();
+  prefs.writeToDisk;
+end