s-news
[Top] [All Lists]

Re[2]: [S] Automatic returning working directory

To: "'CHASALOW; SCOTT [AG/2170]'" <SCOTT.CHASALOW@cereon.com>, "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>, Kin Cheung <kin_cheung@alkermes.com>
Subject: Re[2]: [S] Automatic returning working directory
From: Jean_Adams@usgs.gov (Jean Adams)
Date: Tue, 27 Apr 1999 12:45:32 -0600
Sender: owner-s-news@wubios.wustl.edu
     
     You can get the name of the script file using the function
        guiGetCurrMetaDoc()
     So Kin's commands could be modified as follows:
     
     cwd _ getenv(c("S_PROJ"))
     pgram _ paste(guiGetCurrMetaDoc("Script"), "ssc", sep=".")
     mtext(side=1, paste(cwd, pgram, sep="\\"))
     
     JVA
     jean_adams@usgs.gov


______________________________ Reply Separator _________________________________
Subject: RE: [S] Automatic returning working directory
Author:  Kin Cheung <kin_cheung@alkermes.com> at NBS-Internet-Gateway
Date:    4/27/99 11:54 AM


     
Hi,
        With the help of others, I got it to work.
Thanks!
     
cwd_getenv(c("S_PROJ"))
pgram_"sim.ssc"
mtext(side=1,paste(cwd,pgram,sep="\\"))
     
     
--Kin
     
-----Original Message-----
From: CHASALOW, SCOTT [AG/2170] [mailto:SCOTT.CHASALOW@cereon.com] 
Sent: Tuesday, April 27, 1999 11:41 AM
To: 'Kin Cheung'
Subject: RE: [S] Automatic returning working directory
     
     
Hi,
     
I assume from your file paths that you are working with Splus 4.5 
for Windows.  Here's a function, pwd(), from my efun 2.0 library, 
that will get you part of the way there.  I don't know any way
to get at the name of the script file, except to hardwire it into 
the file itself, e.g.
     
file <- "sim.ssc"
...  # do some stuff
print(paste(pwd(), file, sep = "\\"))
     
You can download the entire efun 2.0 library from statlib or at 
http://www.spg.wau.nl/pv/pub/chasalow/S/win
     
Cheers,
Scott
     
Cereon Genomics
Scott.Chasalow@cereon.com
     
--- CUT HERE ---
     
"pwd" <- 
function()
{
# DATE WRITTEN:  11 Feb 1997             LAST REVISED:  20 Sept 1997 
# AUTHOR:  Scott Chasalow (Scott.Chasalow@users.pv.wau.nl)
#
# DESCRIPTION:
#       Print working directory. This is the "Working Directory"
#       property of an Splus icon: the DOS directory from which Splus 
#       was started.  It has NOTHING to do with the S_WORK environment 
#       variable nor with the Splus search list. But commonly, the
#       directory (e.g. _Data) in position 1 of the Splus search list 
#       will be located in the directory returned by this function. 
# 
   dir <- dos("dir /A:D /-P", output = T, multi = F, translate = F) 
   which <- match(" Directory", substring(dir, 1, 10))
   dir <- dir[which]
   ncd <- nchar(dir)
   dvec <- substring(dir, 1:ncd, 1:ncd) 
   dvec <- dvec[ - (1:14)]
   paste(dvec, collapse = "")
}
     
--- END CUT ---
     
} -----Original Message-----
} From: Kin Cheung [mailto:kin_cheung@alkermes.com] 
} Sent: Tuesday, 27 April 1999 10:57
} To: 's-news@wubios.wustl.edu'
} Subject: [S] Automatic returning working directory 
} Importance: Low
}  
} S+ users,
} 
}       Is there a function that automatically returns the path of myworking 
} directory along with the program name that I am running my program in.
} Suppose I have a file name called "sim.ssc" and is located in 
} "c:\project\pgmlib"
} 
} I would like the function to return "c:\project\pgmlib\sim.ssc" 
} 
} thanks you much!
} 
} --cheung
----------------------------------------------------------------------- 
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe 
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the 
message:  unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>