Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I find where to put temporary files

Status
Not open for further replies.

GlenGodbold

Programmer
Mar 5, 2001
14
GB
Hi everyone!

I'm writing an application which is intended to run directly from a CD, but I need to write one or two temporary files (indexes mainly) to the hard disk.

Given that I'll have no knowledge about potential users setups, how can I reliably find a directory which will have read/write permissions. My tests on standalone PCs have been successful using \windows\temp as the folder to store thefiles, but this fails quite often on NT networks.

Does anyone have any ideas??

Thanks in advance

Glen Godbold
 
Look in to the GETENV() function. This function returns the value of the environment variable used in a "SET" command in autoexec.bat, autoexec.nt etc.

STORE GETENV("TEMP") TO cTmpDir

will store the "temp" directory to cTmpDir.

Dave S.


 
Hi Glen

To run an application from CD, keep in mind the following..
1. There shall be no Input/write to the CD drive. Obviously you will be aware of this. But the opening of TABLES have to be so specific that it is read only. Even then, I do not know, if VFP need to open them with any attribute and so may cause error. (You have to check this with something on a trial basis, before you complete the application)
2. You can have your own configuration file (Read command line switches) and also include in that configuration file
TMPFILES drive:
EDITWORK path
PROGWORK path
SORTWORK path
etc.

Hope this helps


ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Glen,

Your best bet is probably SYS(2023). This returns the temporary path the application is currently using to write temp files. Which in most cases is the same location that Dave mentioned GETENV("TEMP").

I would recommend staying away from putting paths in the configuration file (CONFIG.FPW). These must be full, hard coded paths, (relative paths are ignored) and on a distibuted application aren't very useful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top