# FS_COMMAND_OPENFILEDIRECT

## Definition

  `FSResult FS_ARCHIVE_PROC_FUNC(FSFile *p_file, FSCommandType command /* = FS_COMMAND_OPENFILEDIRECT */);
  `

## Description

Operating specifications for the archive command `FS_COMMAND_OPENFILEDIRECT` are shown below:

Arguments passed to this command

>     This command takes as a command argument the variable arg.openfiledirect that is stored at p_file.
>     This variable is defined in nitro/fs/file.h as shown below:

>     typedef struct
>     {
>         u32     top;
>         u32     bottom;
>         u32     index;
>     } FSOpenFileDirectInfo;

> Argument content is listed below:

Arguments | Content
top | An archive base offset that indicates the top of the file image area. This value is used for area determination in the `FS_SeekFile` function.
bottom | An archive base offset that indicates the bottom of the file image area. This value is used for area determination in the `FS_SeekFile` function.
index | Indicates a file's index. This value is used by the `FS_COMMAND_GETPATH` command.

Actions required of this command

>     It sets the p_file variable prop.file as shown below:

>     Each of the prop.file variables is appropriately set based on the arguments top, bottom, and index.
>       The set values are used by subsequent FS_COMMAND_READFILE and FS_COMMAND_WRITEFILE commands.
>       You may determine your own meanings for the prop.file variables as long as they are appropriate arguments for these commands.
>       However, prop.file.pos must be within the range prop.file.top - prop.file.bottom.

Default Implementation

> The command sets values based on the following determinants:

prop.file.top | Sets the argument `top` as is.
prop.file.bottom | Sets the argument `bottom` as is.
prop.file.pos | Sets the same value as `prop.file.top`
prop.file.own_id | Sets the arguments `index` and `p_file->arc`.

Command Results

>     If this command returns FS_RESULT_SUCCESS, p_file becomes a handle that contains directory position information.
>     Subsequently the FS_IsDir function returns TRUE.
>     It can also be used in arguments in functions that operate on files.

Functions that use this command

> `FS_OpenFileDirect` (indirectly from the default `FS_OPENFILEFAST` command)
> `FS_OpenFile`
> `FS_OpenFileFast`

## See Also

`FSArchive`, `FS_ARCHIVE_PROC_FUNC`, `FS_COMMAND_*`, `FS_SetArchiveProc`

## Revision History

2004/08/25 Fixed error: `FS_COMMAND_WRITE` changed to `FS_COMMAND_WRITEFILE`.
2004/07/12 Initial version.

CONFIDENTIAL