Maybe all you need to do is check the attributes of the folder. If it is flagged as system, you could use API to remove it. Issue the command:
ADIR(laFolders, addbs(justpath(lcTempPath)) + justfname(lcTempPath) + ".", "HSD")
The attributes will be in laFolders[1,5]. If it is Hidden, ReadOnly and/or System, use API to remove the attributes.
procedure ClearAttributes
lparameter tcFileName
if vartype(tcFileName) <> "C" or empty(tcFileName)
return .f.
endif
local lcFile, lnRetVal
lcFile = alltrim(tcFileName)
DECLARE SHORT SetFileAttributes IN KERNEL32 ;
STRING @ lpFileName, ;
INTEGER dwAttributes
lnRetVal = SetFileAttributes(lcFile, 0)
return (lnRetVal > 0)
>I have had an issue recently that surfaces because at run-time, VFP uses the Windows temp directory (unless TMPFILES et al are in the config.fpw file).
>If the temp directory is a System folder, VFP won't (can't?) read (or write?) to it.
>When I set up the Windows temp directory, it is
not a System folder. It is
not a System folder for weeks. And then one day it is. I reboot everyday.
>
>What gives?
>Why isn't it a System folder from the get-go?
>Why does it suddenly become one?
>
>FWIW: We're trying to avoid using a config.fpw file, since we may have hundreds of COM projects and we would like to avoid having to either (1) remember to include the right config.fpw file or (2) create a project creation tool (although this one isn't so bad).
Mark McCasland
Midlothian, TX USA