code: public static List<String> computeScopeFolders(CmsObject cms, CmsGallerySearchParameters params) {
  
          String subsite = null;
          if (params.getReferencePath() != null) {
              subsite = OpenCms.getADEManager().getSubSiteRoot(
                  cms,
                  cms.getRequestContext().addSiteRoot(params.getReferencePath()));
              if (subsite != null) {
                  subsite = cms.getRequestContext().removeSiteRoot(subsite);
              } else if (LOG.isWarnEnabled()) {
                  LOG.warn(
                      Messages.get().getBundle().key(
                          Messages.LOG_GALLERIES_COULD_NOT_EVALUATE_SUBSITE_1,
                          params.getReferencePath()));
              }
          } else if (LOG.isWarnEnabled()) {
              LOG.warn(Messages.get().getBundle().key(Messages.LOG_GALLERIES_NO_REFERENCE_PATH_PROVIDED_0));
          }
  
          List<String> scopeFolders = getSearchRootsForScope(
              params.getScope(),
              cms.getRequestContext().getSiteRoot(),
              subsite);
          return scopeFolders;
      }
docs: Computes the search root folders for the given search parameters based on the search scope.<p>
  
  @param cms the current CMS context
  @param params the current search parameters
  
  @return the search root folders based on the search scope