# FS_COMMAND_GETPATH

## C Specification

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

## Description

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

Arguments passed to this command
  This command takes as a command argument the variable `arg.getpath` that is stored in `p_file`.
  This variable is defined in `nitro/fs/file.h` as shown below:

      typedef struct
              {
                  u8     *buf;
                  u32    buf_len;
                  u16    total_len;
                  u16    dir_id;
              } FSGetPathInfo;

  Argument content is listed below:

  Arguments | Content
  --- | ---
  `buf` | This indicates a pointer to the memory that stores the acquired absolute path name character string. If this value is `NULL`, there is no need to acquire an absolute path name character string.
  `buf_len` | This indicates the memory size of `buf` (bytes).
  `total_len` | This indicates the length of a valid absolute path name character string that has already been calculated. If this value is `0`, you must configure properly.
  `dir_id` | If the target is a directory, this indicates a position; if the target is a file, this indicates the position of the directory to which it belongs. If `total_length` is `0`, you must correctly set the value.

Actions required of this command
  `p_file` holds either file information or directory position information. You can determine which it holds with the `FS_IsFile` function or the `FS_IsDir` function. The argument variables are set as shown below:
  - If the argument `total_len` is `0`, the length of the absolute path name character string indicated by `p_file`, including the terminating '`\0`', will be set in `total_len`. If `p_file` is a directory its value will be set in `dir_id`; if `p_file` is a file, the position of the directory that it belongs to will be set in `dir_id`. If `total_len` is not `0`, it is assured that this command has already made this setting.
  - If the argument `buf` is not `NULL`, the absolute path name character string indicated by `p_file`, including the terminating '`\0`' will be stored in memory. However, if `buf_len` is less than `total_len`, `FS_RESULT_FAILURE` must be returned. At this time, it is possible to either store as much of the character string as possible, or store nothing.

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 is determined that a valid absolute path name character string length has been set in `total_len`, and that if buf is not `NULL`, that the absolute path name character string, including the terminating '`\0`' has been stored.
  Otherwise it will be determined that `buf` is not `NULL`, and that `buf_len` is less than `total_len`.

Functions that use this command
  - `FS_GetPathLength`
  - `FS_GetPathName`

## See Also

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

## Revision History

08/25/2004 Revised the error: FSIdFile is changed to FS_IsFile
07/12/2004 Initial Version