Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stonefield Database Dictionary - Going Forward
Message
From
29/09/2006 18:15:45
 
 
To
29/09/2006 10:41:42
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01156596
Message ID:
01158306
Views:
42
As I mentioned to Tore, it appears to me the problem only surfaces when you use FILE() to query the drive root and the file exists along the VFP path.

In your example you can exclude c:\ from the path and it's still a problem:
set path to c:\windows
>? FILE("c:\explorer.exe")  && returns .T. even though explorer.exe is not at c:\
But
set path to c:\windows
?FILE("c:\foo\explorer.exe")
returns .F. because explorer.exe is not in c:\foo even though it is in c:\windows and c:\windows is in the VFP path.

Interestingly, with the VFP path set to c:\windows, the following also occur:
?FILE("d:\explorer.exe") && returns .T. even though there is no disk in D: (my DVD drive), and
?FILE("s:\explorer.exe") && returns .T. even though there is no drive S: in my system
The VFP Help topic for FILE() says it searches along the VFP path if you do not specify a path with the file name. It looks to me like specifying only a drive letter plus a backslash does not meet the requirement for a path in this situation, although I think most of us would agree it probably should.

Regarding your backup scenario, it seems unlikely a backup folder created by the user would be in your VFP path, assuming the path is set by the EXE based on directories you as the developer include at design time. In any case, if a file resides along the path and you use FILE() to query for only the file name with no path, then returning .T. is the correct behavior.


>Ahh! I get it now. This could certainly be an issue under some circumstances.
>
>I used the following two lines to prove the problem:
>
>
>set path to c:\, c:\windows
>? FILE("c:\explorer.exe")  && returns .T. even though explorer.exe is not at c:\
>
>
>I believe if an explicit path is provided to the file people would expect the file to exist at that specific location and not in any of the paths. In the case of large applications with many files and directories with a complex path statements (like SagePro), it becomes more likely that using the File() command could cause side effects that are not expected.
>
>One common issue I could see is that people often copy tables and files into a 'backup' directory that is nested inside of their application. If this backup folder is in the path the file() function could inadvertantly flag a files existance from the backup that does not exist in the live directory.
Rick Borup, MCSD

recursion (rE-kur'-shun) n.
  see recursion.
Previous
Reply
Map
View

Click here to load this message in the networking platform