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

time-shift
Stéphane Adjemian (Scylla) 2014-06-23 13:54:52 +02:00
parent 11f00d041e
commit 40a60e92fa
3 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,10 @@ function b = check_file_extension(file,type)
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
% Clean-up path
file = strrep(file, '../', '');
file = strrep(file, './', '');
remain = file;
while ~isempty(remain)
[ext, remain] = strtok(remain,'.');

View File

@ -28,6 +28,10 @@ function ext = get_file_extension(file)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Clean-up path
file = strrep(file, '../', '');
file = strrep(file, './', '');
remain = file;
while ~isempty(remain)
[ext, remain] = strtok(remain,'.');

View File

@ -36,7 +36,7 @@ function [freq,init,data,varlist,tex] = load_m_file_data(file)
if isoctave
run(file);
else
[basename, ext] = strtok(file,'.');
basename = file(1:end-2);
run(basename);
end