davidvarga / MBeautifier

MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.
GNU General Public License v3.0
490 stars 77 forks source link

bugfix: MBeautify.formatFiles failed when input directory was a relative path #92

Closed asmfstatoil closed 4 years ago

asmfstatoil commented 4 years ago

Tried running MBeautify.formatFiles('test','*.m') from a folder containing a folder test with some m-files in it and MBeautify.formatFile(file, file) failed to find the file that was already found.

Since dir provides a struct including the full (absolute) folder path I just replaced directory with that information. In the code all structs in the files array will have the same string as folder so

I guess the same could be done by adding if numel(files) > 0 directory = files(1).folder end

but that would not allow for any future feature that allows multiple directories as input.