[Zooimage-commits] r67 - pkg/zooimage/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 15 12:27:25 CEST 2009


Author: romain
Date: 2009-04-15 12:27:25 +0200 (Wed, 15 Apr 2009)
New Revision: 67

Modified:
   pkg/zooimage/R/ZITrain.r
Log:
use list.files to get jpg recursively instead of dos command

Modified: pkg/zooimage/R/ZITrain.r
===================================================================
--- pkg/zooimage/R/ZITrain.r	2009-04-15 10:22:16 UTC (rev 66)
+++ pkg/zooimage/R/ZITrain.r	2009-04-15 10:27:25 UTC (rev 67)
@@ -128,16 +128,19 @@
 		stop("'", dir, "' does not appear to be a ", getTemp("ZIname"), " training set root dir!") 
     
 	# Get a list of subdirs vith vignettes
-	if (isWin()) {
-		# Make sure the directory is written with "\\", not "/"
-		Dir <- gsub("[/]", "\\\\", dir)
-		if (length(grep("[\\]$", Dir)) == 0) Dir <- paste(Dir, "\\", sep = "")
-		cmd <- paste(Sys.getenv("COMSPEC"), " /c dir \"", Dir, "*.jpg\" /B /S", sep = "")
-		res <- system(cmd, intern = TRUE, invisible = TRUE)
-	} else {
-		### TODO: adapt this to other platforms
-		stop("This function is not implemented yet on this platform!")
-	}
+	# if (isWin()) {
+	# 	# Make sure the directory is written with "\\", not "/"
+	# 	Dir <- gsub("[/]", "\\\\", dir)
+	# 	if (length(grep("[\\]$", Dir)) == 0) Dir <- paste(Dir, "\\", sep = "")
+	# 	cmd <- paste(Sys.getenv("COMSPEC"), " /c dir \"", Dir, "*.jpg\" /B /S", sep = "")
+	# 	res <- system(cmd, intern = TRUE, invisible = TRUE)
+	# } else {
+	# 	### TODO: adapt this to other platforms
+	# 	stop("This function is not implemented yet on this platform!")
+	# }
+	
+	res <- list.files.ext( dir, extension = "jpg", recursive = TRUE, full = TRUE )
+	
 	# Check the result...
 	if (length(res) < 1 || length(grep(Dir, res[1], fixed = TRUE)) == 0)
 		stop("Error while getting data from ", dir)



More information about the Zooimage-commits mailing list