Never ending loop in bids_importjson
Hi, when I run pop_importbids, it gets in a never ending loop in line 468, when calling bids_importjson.
I think it has to do with this part of the code.
https://github.com/sccn/EEG-BIDS/blob/bf6001cce2cc64cc28124cf15f185b9314402eb5/bids_importjson.m#L40C4-L55C12
Best, Cristina
@dungscout96 can you have a look. This is code you recently added I think.
specifically this part:
% if ~isTopLevel(curFile)
% upperFile = fullfile(fileparts(fileparts(curFile)), ['*' ext]);
% % resolve wildcard if applicable
% upperFileDir = dir(upperFile);
% if ~isempty(upperFileDir)
% for u=1:numel(upperFileDir)
% % check using rule 2.b and 2.c
% % of https://bids-specification.readthedocs.io/en/stable/common-principles.html#the-inheritance-principle
% upperFileName = upperFileDir(u).name;
% upperFileName_parts = strsplit(upperFileName, '_');
% if contains(oriFile, upperFileName_parts)
% upperFile = fullfile(upperFileDir(u).folder, upperFileDir(u).name);
% break
% end
% end
% end
% upperjsondata = bids_importjson(upperFile, ext, oriFile);
%
% % mergeStructures credit: https://www.mathworks.com/matlabcentral/fileexchange/131718-mergestructures-merge-or-concatenate-nested-structures?s_tid=mwa_osa_a
% curjsondata = mergeStructures(curjsondata, upperjsondata);
% end
Any update here? There appears to be a loop that endlessly looks for upper level .json files if there are none found
This should have been fixed. Please pull the latest changes and let us know if this is still an issue for you. Closing this issue for now
The never ending loop was due to the lack of README.md file at the root. Now, we are also checking for datasetdescription.json which is mandatory (README.md is not)