File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -315,21 +315,23 @@ function potentialLocations(path) {
315315 } ) ;
316316
317317 if ( ses ) {
318- var sessionLevelPath = "/" + sub + "/" + ses + "/" + sessionLevelComponentList . join ( "_" ) ;
319- potentialPaths . push ( sessionLevelPath ) ;
318+ addPotentialPaths ( sessionLevelComponentList , potentialPaths , 2 , "/" + sub + "/" + ses + "/" ) ;
320319 }
321-
322- var subjectLevelPath = "/" + sub + "/" + subjectLevelComponentList . join ( "_" ) ;
323- potentialPaths . push ( subjectLevelPath ) ;
324-
325- var topLevelPath = "/" + topLevelComponentList . join ( "_" ) ;
326- potentialPaths . push ( topLevelPath ) ;
327-
320+ addPotentialPaths ( subjectLevelComponentList , potentialPaths , 1 , "/" + sub + "/" ) ;
321+ addPotentialPaths ( topLevelComponentList , potentialPaths , 0 , "/" ) ;
328322 potentialPaths . reverse ( ) ;
329323
330324 return potentialPaths ;
331325}
332326
327+ function addPotentialPaths ( componentList , potentialPaths , offset , prefix ) {
328+ for ( var i = componentList . length ; i > offset ; i -- ) {
329+ var tmpList = componentList . slice ( 0 , i - 1 ) . concat ( [ componentList [ componentList . length - 1 ] ] ) ;
330+ var sessionLevelPath = prefix + tmpList . join ( "_" ) ;
331+ potentialPaths . push ( sessionLevelPath ) ;
332+ }
333+ }
334+
333335/**
334336 * Generate Merged Sidecar Dictionary
335337 *
You can’t perform that action at this time.
0 commit comments