Consultor Eletrônico



Kbase P35112: How to programmatically determine whether or not a given dir
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/4/2003
Status: Unverified

GOAL:

How to programmatically determine whether or not a given directory is a valid directory in the Operating System?

GOAL:

How to make sure that a given directory really exists in the System using Progress 4GL?

FIX:

In order to validate an OS directory via Progress 4GL, use the FILE-TYPE attribute of the FILE-INFO System Handle. If the character string returned by this attribute call contains the letter "D", then it is a valid directory in the OS. However, if it returns question mark (?), then the specified directory is an invalid directory in the System. e.g.:

DEFINE VARIABLE vcFullPath AS CHARACTER NO-UNDO.
SYSTEM-DIALOG GET-FILE vcFullPath.
FILE-INFO:FILENAME = vcFullPath.
IF FILE-INFO:FILE-TYPE = ? THEN
MESSAGE "File or directory does not exist!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.