# FS_COMMAND_FINDPATH

## Definition

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

## Description

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

Arguments passed to this command

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

>     typedef struct
>     {
>     FSDirPos        pos;
>     const char      *path;
>     BOOL            find_directory;
>     union {
>     FSFileID    *file;
>     FSDirPos    *dir;
>     } result;
>     } FSFindPathInfo;

> Argument content is listed below:

Arguments | Content
`pos` | This indicates the base directory position of the file or directory that is to be searched. The following variables can be ignored: `pos.index`, `pos.pos`.
`path` | Indicates a pointer to a relative path character string, where `pos` is the base.
`find_directory` | If the target of the search is a file, this argument stores `FALSE`; if the target is a directory, this argument stores `TRUE`.
`result.file` | If `find_directory` is `FALSE`, this argument indicates a pointer to a file ID that is used to store search results.
`result.dir` | If `find_directory` is `TRUE`, this will indicate a pointer to a directory position that is used to store search results.

Actions required of this command

>     p_file information does not use anything.
>     The memory that the arguments result.file and result.dir indicate is set as shown below:

>     If the find_directory argument is FALSE, based on the directory position pos,
>     the command will acquire the file ID that is at the relative path position that is indicated by path, and store the value in result.file.

>     If the find_directory argument is TRUE, based on the directory position pos,
>     the command will acquire the directory position that is at the relative path position that is indicated by path, and store the value in result.dir.

>     In either case, the command will do nothing if the specified path is invalid.

Default Implementation

> Seek results from the provided arguments, using only the `FS_COMMAND_SEEKDIR` and `FS_COMMAND_READDIR` commands.

Command Results

>     If FS_RESULT_SUCCESS is returned by the command, it will be determined that correct values, found as search results, are stored in result.file or result.dir.

>     Otherwise, it will be determined that the command failed either because the specified path does not exist, the path format is invalid, or due to some other error.

Functions that use this command

> `FS_ChangeDir`
> `FS_OpenFile`
> `FS_ConvertPathToFileID`

## See Also

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

## Revision History

07/12/2004 Initial version.