This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20.6
Structure file

Structure file 


 

Structure file {( * )} -> Function result 
Parameter Type   Description
Operator in Returns structure file of host database
Function result  String in Long name of the database structure file

The Structure file command returns the pathname of the structure file for the database with which you are currently working.

  • With binary databases, the command returns the pathname of the .4db file. 
  • With project databases, the command returns the pathname of the .4dproject file.

Note: In the particular case of a database that has been compiled and merged with 4D Volume Desktop, this command returns the pathname of the application file (executable application) under Windows and macOS. Under macOS, this file is located inside the software package, in the [Contents:Mac OS] folder. This stems from a former mechanism and is kept for compatibility reasons. If you want to get the full name of the software package itself, it is preferable to use the Application file command. The technique consists of testing the application using the Application type command, then executing Structure file or Application file depending on the context.

WARNING: If you call this command when using 4D in remote mode, only the name of the structure/project file is returned; the pathname is not returned.

The optional * parameter is useful in the case of an architecture using components: it can be used to determine the structure (host or component) for which you want to get the pathname depending on the context in which the command is called:

  • When the command is called from a component:
    • If the * parameter is passed, the command returns the pathname of the structure file of the host database,
    • If the * parameter is not passed, the command returns the pathname of the structure file of the component.
      The structure file of the component corresponds to the structure file (.4db, .4dc, .4dproject, .4dz) of the component found in the “Components” folder of the database. However, a component can also be installed as an alias/shortcut or a .4dbase folder/package:
      • In the case of a component installed as an alias/shortcut, the command returns the pathname of the original file (the alias or shortcut is resolved).
      • In the case of a component installed as a .4dbase folder/package, the command returns the pathname of the file located within this folder/package.
  • When the command is called from a method of the host database, it always returns the pathname of the structure/project file of the host database, regardless of whether or not the * parameter is passed.

This example displays the name and the location of the structure file currently in use:

 C_OBJECT($fullpath)
 C_TEXT($name;$path)
 If(Application type#4D Remote mode)
    $fullpath:=Path to object(Structure file)
    $name:=$fullpath.name
    $path:=$fullpath.parentFolder
    ALERT("You are currently using the database "+Char(34)+$name+Char(34)+" located at "+Char(34)+$path+Char(34)+".")
 Else
    ALERT("You are connected to the database "+Char(34)+Structure file+Char(34))
 End if

The following example can be used to find out whether the method is called from a component:

 C_BOOLEAN($0)
 $0:=(Structure file#Structure file(*))
  ` $0=True if method is called from a component



See also 

_o_DATA SEGMENT LIST
Application file
COMPONENT LIST
Data file

 
PROPERTIES 

Product: 4D
Theme: 4D Environment
Number: 489

This command can be run in preemptive processesDifferent in remote mode

 
PAGE CONTENTS 
 
HISTORY 

Modified: 4D v11 SQL

 
ARTICLE USAGE

4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)