Browse files

refactor make.keyval.reader

  • Loading branch information...
1 parent d635fa4 commit a9e63af3b945d3ec47ed41a4f2693ed50c86cdc4 @piccolbo piccolbo committed Dec 13, 2012
Showing with 11 additions and 11 deletions.
  1. +11 −11 rmr2/pkg/R/IO.R
View
22 rmr2/pkg/R/IO.R
@@ -140,17 +140,17 @@ make.typedbytes.output.format = Curry(make.native.or.typedbytes.output.format, n
# I/O
make.keyval.reader = function(mode, format, keyval.length, con = NULL) {
- if(mode == "text") {
- if(is.null(con)) con = file("stdin", "r")} #not stdin() which is parsed by the interpreter
- else {
- if(.Platform$OS.type == "windows") {
- catwin = system.file(package="rmr2", "bin", .Platform$r_arch, "catwin.exe")
- if(is.null(con)) con = pipe(catwin, "rb")
- }
- else {
- if(is.null(con)) con = pipe("cat", "rb")
- }
- }
+ if(is.null(con))
+ con = {
+ if(mode == "text") {
+ file("stdin", "r")} #not stdin() which is parsed by the interpreter
+ else {
+ cat = {
+ if(.Platform$OS.type == "windows")
+ system.file(package="rmr2", "bin", .Platform$r_arch, "catwin.exe")
+ else
+ "cat"}
+ pipe(cat, "rb")}}
function()
format(con, keyval.length)}

0 comments on commit a9e63af

Please sign in to comment.