[Rprotobuf-commits] r452 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 15 20:43:43 CEST 2012
Author: edd
Date: 2012-05-15 20:43:43 +0200 (Tue, 15 May 2012)
New Revision: 452
Modified:
pkg/R/internals.R
Log:
add missing argument to sprintf() call
Modified: pkg/R/internals.R
===================================================================
--- pkg/R/internals.R 2012-05-15 11:35:28 UTC (rev 451)
+++ pkg/R/internals.R 2012-05-15 18:43:43 UTC (rev 452)
@@ -1,46 +1,46 @@
# set of functions not supposed to be called by the end user
-# these are thin wrappers around C functions, to help with
+# these are thin wrappers around C functions, to help with
# the error trapping on R side
#' thin wrapper around the C function of the same name
#'
#' @param files list of proto files to import
#' @param dir directory in which to look for proto files (ignored if files is given)
-#' @param package if specified, proto files are imported from the "proto" directory
+#' @param package if specified, proto files are imported from the "proto" directory
#' of the package
#' @return invisible(NULL)
-readProtoFiles <- function(
- files,
+readProtoFiles <- function(
+ files,
dir,
package = "RProtoBuf",
pattern = "\\.proto$"
){
-
+
if( missing( files ) ){
if( missing( dir ) ){
if( missing(package) ){
- dir <- getwd()
+ dir <- getwd()
} else {
dir <- system.file( "proto", package = package )
if( !file.exists( dir ) ){
- stop( sprintf("package '%s' does not have a 'proto' directory") )
+ stop( sprintf("package '%s' does not have a 'proto' directory", package) )
}
}
}
- files <- list.files( dir, pattern = pattern, full.names = TRUE )
+ files <- list.files( dir, pattern = pattern, full.names = TRUE )
} else {
if( !is.character( files ) ){
stop( "'file' should be a character vector" )
}
-
+
ex <- sapply( files, file.exists )
if( ! any( ex ) ){
- stop( "none of the files exist" )
+ stop( "none of the files exist" )
}
-
+
# TODO: we need to pass the full path of the file
# or create a mapping from the current working directory
- # in the DiskSourceTree
+ # in the DiskSourceTree
files <- sapply( files[ex], function(x){
tools:::file_path_as_absolute(x)
} )
@@ -53,7 +53,7 @@
getProtobufLibVersion <- function( format = FALSE ){
version <- .Call( "get_protobuf_library_version", PACKAGE = "RProtoBuf" )
-
+
if( format ){
major <- version %/% 10^6
minor <- ( tmp <- (version - major * 10^6) ) %/% 10^3
@@ -62,7 +62,7 @@
} else {
version
}
-
+
}
More information about the Rprotobuf-commits
mailing list