if dir exist

Ken Ray kray at sonsothunder.com
Thu Dec 23 22:14:45 EST 2004


On 12/23/04 2:57 PM, "Paul Salyers" <ps1 at softseven.org> wrote:

> I'm trying to get out on VB thinking and into Rev

Well, as some of us here have a lot of time invested in both (I've been
using VB since VB 3), don't hesitate to ask your questions here.


> I searched under exist and fount nothing. Can some1 help with this code?

Hmm. When I opened the Rev documentation with the Dictionary active, typing
in "exist" gave me two hits: 'existence' and 'exists', both of which have a
tip at the bottom that says "to find out whether a file or folder exists or
whether a process is running, use there (sic) there is a operator".
Unfortunately, the phrase "there is a" is not in bold, so it may not be
readily apparent (RunRev are you taking notice?).

Anyway, using "there is a {file|folder} <path>" is the way to go. If you
know the path exactly, you can do this (paraphrasing your VB code):

if there is a folder "C:\winnt\" then
  put "C:\winnt\" into Dire  -- btw, why "dire?"
else
  put "C:\Windows\" into Dire
end if

If you just want to know what the current "Windows" folder is, you can refer
to the tip at my site:

  http://www.sonsothunder.com/devres/revolution/revolution.htm?_file010

which shows that the phrase "system" can be used with the
'specialFolderPath' function to get what the current Windows/WinNT directory
is for the given system:

  put specialFolderPath("system") into Dire

This also translates into code # 36, which wil give you the same thing:

  put specialFolderPath("36") into Dire

Better to use a one-liner than to type 5 or more lines, IMHO...

Hope this helps,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list