现在的位置: 首页 > 综合 > 正文

FATFS帮助文档——之Path Names

2019年03月23日 ⁄ 综合 ⁄ 共 3130字 ⁄ 字号 评论关闭

翻译的念头起源于应用打开文件 f_opendir(&dir,"") 第二个参数应该是PATH,没懂 “” 是什么意思,现在懂了是根目录。有空看看DOS(因为有人说:“都是没用过DOS的人啊...       
  CD..  CD.”

 

帮助文档在这里 http://elm-chan.org/fsw/ff/en/filename.html

要不要这么恶心,全是英文.......

Path Names

Format of the path names

The format of path name on the FatFs module is similer to the filename specs of DOS/Windos as follows:

#FATFS的路径名格式和DOS/WINDOWS的很像。如下:

"[drive:][/]directory/file"

The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled (_USE_LFN
> 0
). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When drive number is omitted,
the drive number is assumed as default drive (drive 0 or current drive).

#FATFS支持长文件名(LFN)和8.3格式文件名(SFN)。当_USE_LFN >0时长文件名(LFN)可用。

 子目录被\或/隔开,和DOS/Windows API一样。重复的分隔符(即\和/)被跳过和忽视。

 (和DOS/Windows API)只有一个不同就是:逻辑驱动器被指定为一个数词,再跟一个冒号。

 当驱动器号被省略,则假定驱动器为默认驱动器(驱动器0或当前驱动器)。

 

Control characters ('\0' to '\x1F')
are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name at LFN configuration but they are recognized as end of the path name at non-LFN configuration. Trailing spaces and dots are ignored.

#控制符('\0' 到 '\x1F')被识别为路径名结尾。当长文件名被设置有效,路径名里的Leading/embedded
spaces(不知道说的是什么)
会被认为有效并作为名字的一部分;但在长文件名未设置时它们(Leading/embedded spaces)被认为是路径名的结尾。

尾随空格和点被忽视。

注:关于长文件名、短文件名 见《关于长文件名/短文件名

In default configuration (_FS_RPATH == 0), it does not have a concept of current directory like OS oriented file system. All objects
on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive is fixed to drive 0.

When relative path feature is enabled (_FS_RPATH == 1), specified path is followed from the root directory if a heading separator
is exist. If not, it is followed from the current directory of the drive set with f_chdir function.
Dot names are also allowed for the path name. The default drive is the current drive set with f_chdrive function.

#默认设置下 (_FS_RPATH
== 0,ysmz4:v0.0.7a里没找到呢.大概因为没有ffconf.h
),它没有一个这样的操作系统当前目录的文件系统的概念卷上的所有对象总是被指定在全路径下,且全路径来自根目录。不允许点目录名(相对路径)。标题分隔符被忽略,它可以存在或默认驱动器固定驱动0

当使能相对路径(_FS_RPATH
== 1
),如果标题分隔符存在,指定的路径将跟在根目录;否则,将跟在驱动器的当前目录,由f_chdirysmz4:v0.0.7a里没找到呢)提供。

路径名也支持点名字。默认驱动器为当前驱动器,由f_chdrive (ysmz4:v0.0.7a里没找到呢)提供。


Path name _FS_RPATH == 0 _FS_RPATH == 1
file.txt A file in the root directory of the drive 0 A file in the current directory of the current drive
/file.txt A file in the root directory of the drive 0 A file in the root directory of the current drive
  The root directory of the drive 0 The current directory of the current drive
/ The root directory of the drive 0 The root directory of the current drive
2: The root directory of the drive 2 The current directory of the drive 2
2:/ The root directory of the drive 2 The root directory of the drive 2
2:file.txt A file in the root directory of the drive 2 A file in the current directory of the drive 2
../file.txt Invalid name A file in the parent directory
. Invalid name This directory
.. Invalid name Parent directory of the current directory
dir1/.. Invalid name The current directory
/.. Invalid name The root directory (sticks the top level)

When option _STR_VOLUME_ID is specified, also pre-defined
strings can be used as drive identifier in the path name instead of a numeral.

#当_STR_VOLUME_IDysmz4:v0.0.7a里没找到呢)被指定,预定义的字符串可以作为路径名里的卷标,从而替代了数词。









抱歉!评论已关闭.