FILPATH

Contents


Filpath creates the path of access to a file while considering reference applications and volumes.

Syntax

filpath(directory, fil_nam, extens [, appli [,vol [,mach]]])

Parameters

Element

Description

Restrictions

directory

Alphanumeric expression that gives the name of the sub-directory of the application that contains the file.

None

fil_nam

Alphanumeric expression that gives the filename

None

extens

Alphanumeric expression that gives the extension of the file

- maximum of 12 characters

appli

- Numeric expression that describes a reference application, or
- Alphanumeric expression that describes any application

-1 <= appli <= 8

12 characters, maximum

vol

Alphanumeric expression that gives the name of the volume

A letter or the zero (0)

mach

Alphanumeric expression that gives the name of a remote machine

Adonix Server

 

Examples

   # Test on the existence of the "CLIENT" table in the current application
    If filinfo(filpath("FIL","CLIENT","fde",-1),1) <0:  Goto INEX:  Endif
   # Path of the current application on its server
    [L]DIRAPPLI = filpath("", "", "","","",adxmac(0))
   # Path of the "A" volume on the current server
    [L]DIRVOLA = filpath("!","","","","A")
   # Test of existence on a modified printer driver
    If filinfo(filpath("!imp",[L]PILOTE,"","","",[S]adxmac(0)),0) >= 0
   # Creation of any path
    [L]CHEMIN = filpath([L]DIR, [L]FICH, [L]EXT, [L]APPLI, [L]VOL, [L]S)

 

Description and Comments

The filpath function creates a path according to the parameters passed. This result assumes nothing about the existence of the file described accordingly. The last three parameters are optional, since the others may be empty strings. The parameters that are too long will be truncated. Under DOS, you will be able to use the slash (/) instead of the backslash (\). The result is of the Char type in the following format:
[ serv@ | #@ | @]/vol_volume_path/appli/directory/fil_nam.extens

These are the rules:

·         If the directory name begins with an exclamation point (!), then Adonix ignores the appli parameter

·         If the directory name is the period (.), then Adonix creates a corresponding path beginning with period slash (./) and ignores the appli and vol parameters.

 

·         If the filename begins with a slash (/), then Adonix considers that this is an absolute path, and the appli, vol, and directory parameters are not taken into account.

·         If fil_nam contains a period (.) (i.e., is in the "A.B" format), then Adonix considers that the first part ("A") is the application and the second ("B") is a file of this application. Adonix does not then take the appli parameter into account.

·         Otherwise, the path describes a file in the current application's directory by default. filpath( "", "", "") gives the path of the current application, accordingly.

 

·         If appli has a positive value, Adonix considers that the file is in the reference application of 'appli' number.

·         If the name of the application (or its number) is not specified, everything takes place as if it equalled -1

·         If appli equals -1, the file is first searched for in the current application. If it is not found there, it is searched for in the reference applications, in the order in which they were declared. Finally, if it is still not found, everything takes place as if it existed in the current application.

·         If appli equals zero (0) or an empty string (""), Adonix considers that the file is in the current application.

 

·         If the volume is not specified, Adonix considers that it is the one where the application described is installed - if it exists. If it does not exist on a single volume, Adonix considers that it is in the Adonix installation directory ([S]adxdir).

·         If the volume does not exist, Adonix does not generate any errors, but returns an empty string.

 

·         If mach is given, then the server name is specified in the character string returned in the "server@path" format. If the server is on the same machine as the engine, then the string returned is in the "path" format.

·         If mach equals an empty string (""), Adonix considers that the file is on the machine where the application (server) is installed.

·         If mach equals the pound sign (#), then this local machine (client) is taken into account.

 

Remarks

The result can be used directly by the filinfo function, which ensures the existence of a file and determines some of its characteristics. On the other hand, you will have to decode the result before using it in a System command to manage the server name.

The filcom function, which allows the same parameters as filpath, determines the comments associated with an existing file.

 

Associated Errors

Error

Description

ERMODE (10)

One of the parameters does not have the desired type.

ERDOM (50)

appli < -1 or appli > number of reference applications

PAFIC (20)

Server no accessible

 

Associated Keywords

FILCOM - FILINFO - ADXDIR - NOMAP - ADXMOTHER - ADXMAC


CONTENTS


Copyright © Sage 1999 - 2007