How it is possible that TEMP or TMP is undefined ?
They are added automatically by Windows!
I use the following routine from UT API section to get temporary folder. This eliminates error if
set TEMP= placed in autoexec.bat file points to illegal directory.
I think that VFP uses
the same API call for default TMPFILES setting . How can environment veriables affect to this process?
function GetPath
DECLARE INTEGER GetTempPath IN "kernel32" ;
LONG nBufferLength, ;
STRING lpBuffer
LOCAL lnBufferLength, lcBuffer
lnBufferLength = 512
lcBuffer = REPLICATE( " ", lnBufferLength )
lnReturn = GetTempPath( lnBufferLength, @lcBuffer )
lcBuffer = STRTRAN( TRIM( lcBuffer ), CHR(0), '' )
RETURN lcBuffer
>Whenever I see this, I just go to DOS and type "ATTRIB C:\TEMP -S".
>
>Other cases where I have seen this problem is if the TEMP or TMP environment variables aren't defined.
>
>>>c:\temp could be marked as a System folder.
>>>
>>>I have this problem temporarily, where the Windows temp folder I assigned is not a System folder for a while, then suddenly one day it is. I have no idea why it suddenly is.
>>
>>In my case, terminal server was installed. Maybe this causes this problem ?
>>
>>How to make temporary file folder back to non-system folder on NT server ?
>>
>>>VFP ignores system folders. Cursors are created in memory but have a path assigned, but not necessarily disk presence.
>>>When a DBF() (usu. w/ APPEND FROM DBF()...) or ALTER TABLE is fired on it, it tries to get it from disk. Since it ignores system folders, the file doesn't exist.
>>
>>I checked that
>>
>>SELECT ... INTO TABLE c:\TEMP\mytbl
>>
>>works OK. Why in this case error does not occur ?
>>
>>>You can include a config.fpw file in your exe with a TMPFILES directive to a folder that is definitely not a system file - like a relative path to "myapplicationstempfolder".
>>
>>Unfortunately, I cannot re-compile exe file. I don't have exact source code. config.fpw file is included in .exe . I can add some init code to this
>>.exe file using CodeBlock. However, VFP is unable to change TMPFILES setting in code.
>>How to resolve this ?
>>
>>Also, I have generic appication and idea not using OS temporary folder for temporary files seems strange.
Andrus