[Raster-commits] r399 - in pkg/raster: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 9 10:31:00 CEST 2009


Author: rhijmans
Date: 2009-04-09 10:31:00 +0200 (Thu, 09 Apr 2009)
New Revision: 399

Modified:
   pkg/raster/R/filenames.R
   pkg/raster/R/setFilename.R
   pkg/raster/man/fileFunctions.Rd
Log:


Modified: pkg/raster/R/filenames.R
===================================================================
--- pkg/raster/R/filenames.R	2009-04-06 16:16:33 UTC (rev 398)
+++ pkg/raster/R/filenames.R	2009-04-09 08:31:00 UTC (rev 399)
@@ -14,6 +14,7 @@
 
 
 .shortFileName <- function(filename) {
+# is this the same as basename ?
     filename <- gsub("\\\\", "/", filename)
 	if (filename == "") {return(filename)
 	} else {
@@ -24,7 +25,8 @@
 	}	
 }   
    
-path <- function(filename) {
+.path <- function(filename) {
+#  use dirname instead
     filename <- gsub("\\\\", "/", filename)
 	file <- .shortFileName(filename)
 	path <- gsub(file, '', filename)

Modified: pkg/raster/R/setFilename.R
===================================================================
--- pkg/raster/R/setFilename.R	2009-04-06 16:16:33 UTC (rev 398)
+++ pkg/raster/R/setFilename.R	2009-04-09 08:31:00 UTC (rev 399)
@@ -17,12 +17,13 @@
 	if (is.na(filename) || is.null(filename)) {
 		filename <- ""
 	}
+	filename <- path.expand(filename)
 	if (class(x)=='RasterStack') {
 		ext(filename) <- ".stk"
 		x at filename <- filename
 	} else {
 		x at file@name <- filename
-		shortname <- .shortFileName(filename)
+		shortname <- basename(filename)
 		ext(shortname) <- ""
 		shortname <- gsub(" ", "_", shortname)
 		if (nbands(x) > 1) { 

Modified: pkg/raster/man/fileFunctions.Rd
===================================================================
--- pkg/raster/man/fileFunctions.Rd	2009-04-06 16:16:33 UTC (rev 398)
+++ pkg/raster/man/fileFunctions.Rd	2009-04-09 08:31:00 UTC (rev 399)
@@ -2,21 +2,18 @@
 
 \alias{ext}
 \alias{ext<-}
-\alias{path}
 \alias{trim}
 
 \title{Filename manipulation}
 
 \description{
-  Low level functions for file name handling. 
-  Get or change file extension or extract the filename or path from a full name (path + filename). 
-  use \code{trim} to remove the whitespace before or after a string of characters.
+Get or change a file extension
+use \code{trim} to remove the whitespace before or after a string of characters.
 }
 
 \usage{
 ext(filename)
 ext(filename) <- value
-path(filename)
 trim(x)
 }
 
@@ -38,7 +35,6 @@
 ext(fn)
 ext(fn) <- ".txt"
 ext(fn)
-path(fn)
 }
 
 \keyword{file}



More information about the Raster-commits mailing list