Detecting whether a path exists. 
Author Message
 Detecting whether a path exists.

Can I detect whether or not a given path exists? I'd like to know because at
the moment, if I try to save from my program to a non-existent drive or
directory, I get a {*filter*} run-time error.

Be gentle, I'm new to this.

... My whole life is waiting for something to happen.
--
Gargamel : Arch-enemy of the bane of all humanity - The Smurfs. |
---------------------------------------------------------------'

                       /// waiting to be fulfilled.
Uploaded to news.dial.pipex.com at 19:58 on 16/10/1998



Wed, 18 Jun 1902 08:00:00 GMT  
 Detecting whether a path exists.

:Can I detect whether or not a given path exists? I'd like to know because at

 45) How to establish if a name refers to a directory or not?
 47) How can I test whether a file exists?

 151578 Oct 10 1998 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

   All the best, Timo

....................................................................

Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.
Advice on spam foiling at http://www.uwasa.fi/~ts/info/spamfoil.html



Wed, 18 Jun 1902 08:00:00 GMT  
 Detecting whether a path exists.

Quote:
> Can I detect whether or not a given path exists? I'd like to know because at
> the moment, if I try to save from my program to a non-existent drive or
> directory, I get a {*filter*} run-time error.

Hello, this is a simple function, you can use.
Andras

function path_exist(path: string): boolean;
var curDir: string;
begin
{$I-}
  GetDir(0,curDir);
  ChDir(path);
  path_exist := IOresult = 0;
  ChDir(curDir);
{$I+} {Not requred, but it's by default}
end;



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. check whether file exists?

2. How to append fields to existing tables, without damageing the existing data

3. How to check whether an object has been registered in the registry

4. Checking whether inside a transaction

5. How to know whether DB is being used ??

6. Testing whether StdIn and StdOut have been redirected

7. Checking whether record in db already read

8. help I need to know whether this can be done

9. Check whether value is repeated

10. How can I detect if a property exists in Controls[i] at runtime?

11. Retrieve Alias Path?

12. Reading Path to an Alias

 

 
Powered by phpBB® Forum Software