Skip to content
Snippets Groups Projects
Commit 40a60e92 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Fixed bug when loaded m file data is not in the current folder or a subfoler.

parent 11f00d04
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,10 @@ function b = check_file_extension(file,type) ...@@ -19,6 +19,10 @@ function b = check_file_extension(file,type)
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr % AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
% Clean-up path
file = strrep(file, '../', '');
file = strrep(file, './', '');
remain = file; remain = file;
while ~isempty(remain) while ~isempty(remain)
[ext, remain] = strtok(remain,'.'); [ext, remain] = strtok(remain,'.');
......
...@@ -28,6 +28,10 @@ function ext = get_file_extension(file) ...@@ -28,6 +28,10 @@ function ext = get_file_extension(file)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Clean-up path
file = strrep(file, '../', '');
file = strrep(file, './', '');
remain = file; remain = file;
while ~isempty(remain) while ~isempty(remain)
[ext, remain] = strtok(remain,'.'); [ext, remain] = strtok(remain,'.');
......
...@@ -36,7 +36,7 @@ function [freq,init,data,varlist,tex] = load_m_file_data(file) ...@@ -36,7 +36,7 @@ function [freq,init,data,varlist,tex] = load_m_file_data(file)
if isoctave if isoctave
run(file); run(file);
else else
[basename, ext] = strtok(file,'.'); basename = file(1:end-2);
run(basename); run(basename);
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment