Documentos sistema
Legacy commands from this theme can usually be usefully replaced by commands of the File and Folder theme and their associated File, Folder, ZipFile and ZipFolder classes, allowing you to handle files and folders as objects.
Número de referencia del documento
You open a document with the Open document, Create document and Append document commands. Once a document is open, you can read and write characters from and to the document using commands such as RECEIVE PACKET and SEND PACKET. When you are finished with the document, you usually close it using the CLOSE DOCUMENT command.
Todos los documentos abiertos devueltos por estos comandos se referencian utilizando un número de referencia del documento (DocRef). A DocRef uniquely identifies an open document. It is formally an expression of the Time type. Todos los comandos que trabajan con documentos abiertos esperan DocRef como parámetro. Si pasa un DocRef incorrecto a uno de estos comandos, se produce un error del gestor de archivos.
Un documento sólo puede ser abierto en modo lectura/escritura por un proceso a la vez. In read-only mode, one process can open several documents, several processes can open multiple documents, you can open the same document as many times as necessary, but you cannot open the same document in read/write mode twice at a time. The Create document and Append document commands automatically open documents in read/write mode. Only the Open document command lets you choose the opening mode.
When it is called from a preemptive process, a DocRef reference can only be used from this preemptive process. Cuando se llama desde un proceso cooperativo, se puede utilizar una referencia DocRef de cualquier otro proceso cooperativo.
The Document system variable
Open document, Create document, Append document and Select document enable you to access a document using the standard Open or Save file dialog boxes. When you access a document through a standard dialog, 4D returns the full pathname of the document in the Document system variable. This system variable has to be distinguished from the document parameter that appears in the parameter list of the commands.
Ruta absoluta o relativa
Most of the routines of this section accept document names, relative pathnames or absolute pathnames:
Los nombres de ruta relativos definen una ubicación con respecto a una carpeta situada en el disco. Si sólo se pasa el nombre del documento, se considera que se está utilizando una ruta relativa. In 4D, a relative pathname is usually expressed with respect to the database folder, i.e. the folder containing the structure file. Los nombres de ruta relativos son especialmente útiles cuando se despliegan aplicaciones en entornos heterogéneos. Absolute pathnames define a location with respect to the root of the volume and so they do not depend on the current location of the database folder. Para determinar si una ruta pasada a un comando debe ser interpretada como absoluta o relativa, 4D aplica un algoritmo específico en cada plataforma.
Windows
If the parameter contains only two characters and if the second one is a ':',
or if the text contains ':' and '' as the second and third character,
or if the text starts with "\",
then the pathname is absolute.
In all other cases, the pathname is relative.
Ejemplos con el comando CREATE FOLDER:
CREATE FOLDER("lundi") // relative path CREATE FOLDER("\Monday") // relative path CREATE FOLDER("\Monday\Tuesday") // relative path CREATE FOLDER("c:") // absolute path CREATE FOLDER("d:\Monday") // absolute path CREATE FOLDER("\srv-Internal\temp") // absolute path
macOS
Si el texto comienza con un separador de carpetas ':',
o si no contiene ninguno,
entonces la ruta es relativa.
En los demás casos, es absoluta.
Ejemplos con el comando CREATE FOLDER:
CREATE FOLDER("Monday") // relative path CREATE FOLDER("macintosh hd:") // absolute path CREATE FOLDER("Monday:Tuesday") // absolute path (a volume must be called Monday) CREATE FOLDER(":Monday:Tuesday") // relative path
Extracting pathname contents
Puede manejar el contenido de las rutas utilizando los comandos Path to object y Object to path. En particular, usando estos comandos, se puede extraer de una ruta:
a file name, the parent folder path, the file or folder extension.