diff --git a/+af_tools/+utils/appendextension.m b/+af_tools/+utils/appendextension.m index 12b5850068a1e4edd4aa3ff1543c2e216ed2182e..a334faa0484c92b10b9eeb97a358289e74cb3766 100644 --- a/+af_tools/+utils/appendextension.m +++ b/+af_tools/+utils/appendextension.m @@ -9,8 +9,13 @@ function str = appendextension(str, ext) % ---------------------------------------------------------------------------------------------- - if isempty(regexp(str, [ext, '$'], 'once')) + [~, ~, fileExt] = fileparts(str); + if isempty(fileExt) str = strcat(str, ext); + elseif ~isempty(fileExt) && ~strcmp(fileExt, ext) + error('MATLAB:appendextension:IncorrectExtension', ... + 'Incorrect extension. File %s is expected to be a ''%s''. Found ''%s''.', ... + str, ext, fileExt); end end diff --git a/CHANGELOG.md b/CHANGELOG.md index 0601b31b7ae7e8b4830709aa00d6219abb0f7697..fd975b8d6526af2242d4c983e7f81f94e4612862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **formatairfoilcoord**: fix issue with autosave - **xf2mat**: add error when input is not a proper xfoil/xflr5 result - **plotpolar**: fix issue when unavailable data +- **all**: add check if wrong filetype is detected ## [4.0.0] - 2022-06-09