Skip to content
Snippets Groups Projects
Select Git revision
  • f138685e532483dde5ad30659dfc67340d664d1a
  • master default protected
  • 6.x protected
  • madysson
  • 5.x protected
  • asm
  • time-varying-information-set
  • 4.6 protected
  • dynare_minreal
  • dragonfly
  • various_fixes
  • 4.5 protected
  • clang+openmp
  • exo_steady_state
  • declare_vars_in_model_block
  • julia
  • error_msg_undeclared_model_vars
  • static_aux_vars
  • slice
  • aux_func
  • penalty
  • 6.4 protected
  • 6.3 protected
  • 6.2 protected
  • 6.1 protected
  • 6.0 protected
  • 6-beta2 protected
  • 6-beta1 protected
  • 5.5 protected
  • 5.4 protected
  • 5.3 protected
  • 5.2 protected
  • 5.1 protected
  • 5.0 protected
  • 5.0-rc1 protected
  • 4.7-beta3 protected
  • 4.7-beta2 protected
  • 4.7-beta1 protected
  • 4.6.4 protected
  • 4.6.3 protected
  • 4.6.2 protected
41 results

conf.py

Blame
  • check_matlab_path.m 5.62 KiB
    function check_matlab_path(change_path_flag)
    
    % Copyright (C) 2015-2016 Dynare Team
    %
    % This file is part of Dynare.
    %
    % Dynare is free software: you can redistribute it and/or modify
    % it under the terms of the GNU General Public License as published by
    % the Free Software Foundation, either version 3 of the License, or
    % (at your option) any later version.
    %
    % Dynare is distributed in the hope that it will be useful,
    % but WITHOUT ANY WARRANTY; without even the implied warranty of
    % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % GNU General Public License for more details.
    %
    % You should have received a copy of the GNU General Public License
    % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
    
    if ~nargin || isempty(change_path_flag)
        change_path_flag = true;
    end
    
    % Get path to dynare/matlab folder.
    DYNARE_PATH = strrep(which('dynare'),'dynare.m','');
    
    if isempty(DYNARE_PATH)
        % Nothing to do here (this case should not happen)
        disp('dynare.m is not in the Matlab''s path.')
        return
    else
        % Removes trailing slash.
        DYNARE_PATH = DYNARE_PATH(1:end-1);
    end
    
    % Get matlab path
    MATLAB_PATH = path();
    if isoctave
        % Octave always has '.' at the top of the path, so remove '.:'
        MATLAB_PATH = MATLAB_PATH(3:end);
    end
    
    % Position of DYNARE_PATH in MATLAB_PATH
    idDYNARE = strfind(MATLAB_PATH,DYNARE_PATH);
    
    if isempty(idDYNARE)
        disp('dynare.m is not in the Matlab''s path.')
        return
    else
        if isequal(length(idDYNARE),1)
            if isequal(idDYNARE, 1)
                % Dynare is on top of matlab's path! Nothing to do here...
                return
            else
                str0 = sprintf('Dynare is not on top of matlab''s path!');
                % Check that this will not create a problem
                MATLAB_PATH_ = path2cell(MATLAB_PATH);
                DYNARE_ROUTINES = getallroutinenames(DYNARE_PATH, getalldirectories(DYNARE_PATH));
                MATLAB_ROUTINES = {};
                for i=1:position(idDYNARE, MATLAB_PATH)
                    TMP_MATLAB_ROUTINES = getallroutinenames(MATLAB_PATH_{i});
                    MATLAB_ROUTINES = { MATLAB_ROUTINES{:}  TMP_MATLAB_ROUTINES{:} };
                end
                COMMON_ROUTINES = intersect(MATLAB_ROUTINES, DYNARE_ROUTINES);
                if ~isempty(COMMON_ROUTINES)
                    warning off backtrace
                    skipline()
                    if length(COMMON_ROUTINES)==1
                        warning(sprintf('%s This can cause problems because the Dynare version of %s will be overriden.', str0, COMMON_ROUTINES{1}));
                    else