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

Rewrote get_file_extension.

parent 73313dc5
No related merge requests found
...@@ -11,7 +11,7 @@ function ext = get_file_extension(file) ...@@ -11,7 +11,7 @@ function ext = get_file_extension(file)
% REMARKS % REMARKS
% If the provided file name has no extension, the routine will return an empty array. % If the provided file name has no extension, the routine will return an empty array.
% Copyright (C) 2013 Dynare Team % Copyright (C) 2013-2015 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -28,15 +28,9 @@ function ext = get_file_extension(file) ...@@ -28,15 +28,9 @@ 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 [dir, fname, ext] = fileparts(file);
file = strrep(file, '../', '');
file = strrep(file, './', '');
remain = file; if ~isempty(ext)
while ~isempty(remain) % Removes the leading dot.
[ext, remain] = strtok(remain,'.'); ext = ext(2:end);
end
if strcmp(ext,file)
ext = [];
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment