| 4D v14.3Test path name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v14.3
 Test path name 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Test path name ( pathname ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| pathname | String |   | Pathname to directory, folder or document | |||||
| Function result | Longint |   | 1, pathname refers to an existing document 0, pathname refers to an existing directory or folder <0, invalid pathname, OS file manager error code | |||||
The Test path name function checks if a document or folder whose name or pathname you pass in pathname is present on the disk. You can pass either a relative or absolute pathname, expressed in the syntax of the current system.
If a document is found, Test path name returns 1. If a folder found, Test path name returns 0.
The following predefined constants are provided by 4D:
| Constant | Type | Value | 
| Is a document | Longint | 1 | 
| Is a folder | Longint | 0 | 
If no document nor folder is found, Test path name returns a negative value (i.e. -43 for File not found).
The following tests if the document “Journal” is present in the folder of the database, then creates it if it was not found:
 If(Test path name("Journal")#Is a document)
    $vhDocRef:=Create document("Journal")
    If(OK=1)
       CLOSE DOCUMENT($vhDocRef)
    End if
 End if
	Product:  4D
	Theme:  System Documents
	Number:  
        476
        
        
        
	
	Created:  4D v6
Convert path system to POSIX
Create document
CREATE FOLDER
	4D Language Reference ( 4D v14 R3)
	4D Language Reference ( 4D v14 R2)
	4D Language Reference ( 4D v13.5)
	4D Language Reference ( 4D v14.3)
	4D Language Reference ( 4D v14 R4)
Inherited from : Test path name ( 4D v11 SQL Release 6)