Revision: 88
http://bugs-r.svn.sourceforge.net/bugs-r/?rev=88&view=rev
Author: ggorjan
Date: 2008-10-10 21:06:41 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Some more test to make sure we find a binary that exists. This should also solve some dubious warnings on Mac, where which or locate would return "no winepath in ...". Now findUnixBinary will fail with a meaningfull error message.
Modified Paths:
--------------
trunk/R2WinBUGS/R/wineutils.R
Modified: trunk/R2WinBUGS/R/wineutils.R
===================================================================
--- trunk/R2WinBUGS/R/wineutils.R 2008-09-16 09:04:14 UTC (rev 87)
+++ trunk/R2WinBUGS/R/wineutils.R 2008-10-10 21:06:41 UTC (rev 88)
@@ -2,7 +2,7 @@
{
## --- Environmental variable ---
tmp <- Sys.getenv(toupper(x))
- if(nchar(tmp) != 0) return(tmp)
+ if(nchar(tmp) != 0 && file.exists(tmp)) return(tmp)
## else
## --- Standard place ---
@@ -12,13 +12,13 @@
## --- Which ---
tmp <- system(paste("which ", x, sep=""), intern=TRUE)
- if(length(tmp) != 0) return(tmp)
+ if(length(tmp) != 0 && file.exists(tmp)) return(tmp)
## else ..
## --- Locate ---
tmp <- system(paste("locate ", x, " | grep bin/", x, "$", sep=""), intern=TRUE)
tmp <- tmp[length(tmp)] ## keep only last hit
- if(length(tmp) > 0) return(tmp)
+ if(length(tmp) > 0 && file.exists(tmp)) return(tmp)
stop(paste("couldn't find", x, "binary file"))
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|