code: private String getTargetSiteRoot(CmsObject cms, String path, String basePath) {
  
          if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
              return null;
          }
          String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path);
          if ((targetSiteRoot == null) && (basePath != null)) {
              targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath);
          }
          if (targetSiteRoot == null) {
              targetSiteRoot = cms.getRequestContext().getSiteRoot();
          }
          return targetSiteRoot;
      }
docs: Returns the target site for the given path.<p>
  
  @param cms the cms context
  @param path the path
  @param basePath the base path
  
  @return the target site