Page 1 of 1 1
Topic Options
#160276 - 2006-04-04 01:56 AM Fix Exist()
Gaven Offline
Starting to like KiXtart
*

Registered: 2003-06-19
Posts: 103
Loc: Washinton DC, USA
Say the directory c:\files exists and is empty.

The function Exist("c:\files\*.*") returns true even when there are no files in the directory. I'm thinking the current and parent directory references are what's throwing the function. Can this be fixed?

Top
#160277 - 2006-04-04 10:32 AM Re: Fix Exist()
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Well, since Exist() checks for a specified file, and *.* is a wildcard...
Nothing wrong with the function really..
edit: oh, just realized your point. but that's only if you do a complete wildcard... ( *.* )
Reading the usage instructions you realize that the wildcarding supported is *.file-extension or filename.*
Code:

Exist( )
Action: Checks for the existence of one or more files.

Syntax: Exist ("file name")

Parameters: File name

Identifies the file(s) you want to locate.

Remarks: Supports wildcards.

Returns:

0


File not found

1


File found

Examples:

IF EXIST (@LDRIVE + "\users.txt")
DISPLAY @LDRIVE + "\users.txt"
ENDIF

IF EXIST (@LDRIVE + "\*.INI")
; Etc, etc.
ENDIF



Edited by ewook (2006-04-04 11:26 AM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#160278 - 2006-04-04 11:02 AM Re: Fix Exist()
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yup, *.* doesn't and hasn't worked as expected.
_________________________
!

download KiXnet

Top
#160279 - 2006-04-04 11:08 AM Re: Fix Exist()
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
As a workaround I use the CountFiles() UDF.
It would be nice if Exist() could recognize *.* as a filename and not count . and .. as a file.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#160280 - 2006-04-04 11:34 AM Re: Fix Exist()
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
actually, I think the current behavior is correct, even though not expected for many.
* in kixtart wildcards is any count of any characters, including none.
think we are used to it meaning 1 or more.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1739 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.053 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org