1# File share/R/nspackloader.R 2# Part of the R package, https://www.R-project.org 3# 4# Copyright (C) 1995-2012 The R Core Team 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# A copy of the GNU General Public License is available at 17# https://www.r-project.org/Licenses/ 18 19local({ 20 info <- loadingNamespaceInfo() 21 pkg <- info$pkgname 22 ns <- .getNamespace(as.name(pkg)) 23 if (is.null(ns)) 24 stop("cannot find namespace environment for ", pkg, domain = NA); 25 dbbase <- file.path(info$libname, pkg, "R", pkg) 26 lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") 27}) 28