SdFat
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Private Member Functions | List of all members
FatFileSystem Class Reference

Integration class for the FatLib library. More...

#include <FatFileSystem.h>

Inheritance diagram for FatFileSystem:
Inheritance graph
[legend]
Collaboration diagram for FatFileSystem:
Collaboration graph
[legend]

Public Member Functions

bool chdir (bool set_cwd=false)
 
bool chdir (const char *path, bool set_cwd=false)
 
void chvol ()
 
bool exists (const char *path)
 
void ls (print_t *pr, uint8_t flags)
 
void ls (print_t *pr, const char *path, uint8_t flags)
 
bool mkdir (const char *path, bool pFlag=true)
 
bool remove (const char *path)
 
bool rename (const char *oldPath, const char *newPath)
 
bool rmdir (const char *path)
 
bool truncate (const char *path, uint32_t length)
 
FatVolumevol ()
 
FatFilevwd ()
 
bool wipe (print_t *pr=0)
 

Private Member Functions

uint8_t blocksPerCluster () const
 
uint32_t blocksPerFat () const
 
cache_tcacheClear ()
 
uint32_t clusterCount () const
 
uint8_t clusterSizeShift () const
 
uint32_t dataStartBlock () const
 
int8_t dbgFat (uint32_t n, uint32_t *v)
 
uint8_t fatCount ()
 
uint32_t fatStartBlock () const
 
uint8_t fatType () const
 
int32_t freeClusterCount ()
 
bool init ()
 
bool init (uint8_t part)
 
uint16_t rootDirEntryCount () const
 
uint32_t rootDirStart () const
 

Detailed Description

Integration class for the FatLib library.

Member Function Documentation

bool FatFileSystem::chdir ( bool  set_cwd = false)
inline

Change a volume's working directory to root

Changes the volume's working directory to the SD's root directory. Optionally set the current working directory to the volume's working directory.

Parameters
[in]set_cwdSet the current working directory to this volume's working directory if true.
Returns
The value true is returned for success and the value false is returned for failure.
bool FatFileSystem::chdir ( const char *  path,
bool  set_cwd = false 
)
inline

Change a volume's working directory

Changes the volume working directory to the path subdirectory. Optionally set the current working directory to the volume's working directory.

Example: If the volume's working directory is "/DIR", chdir("SUB") will change the volume's working directory from "/DIR" to "/DIR/SUB".

If path is "/", the volume's working directory will be changed to the root directory

Parameters
[in]pathThe name of the subdirectory.
[in]set_cwdSet the current working directory to this volume's working directory if true.
Returns
The value true is returned for success and the value false is returned for failure.
void FatFileSystem::chvol ( )
inline

Set the current working directory to a volume's working directory.

This is useful with multiple SD cards.

The current working directory is changed to this volume's working directory.

This is like the Windows/DOS <drive letter>: command.

bool FatFileSystem::exists ( const char *  path)
inline

Test for the existence of a file.

Parameters
[in]pathPath of the file to be tested for.
Returns
true if the file exists else false.
void FatFileSystem::ls ( print_t pr,
uint8_t  flags 
)
inline

List the directory contents of the volume working directory.

Parameters
[in]prPrint stream for list.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

void FatFileSystem::ls ( print_t pr,
const char *  path,
uint8_t  flags 
)
inline

List the directory contents of a directory.

Parameters
[in]prPrint stream for list.
[in]pathdirectory to list.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

bool FatFileSystem::mkdir ( const char *  path,
bool  pFlag = true 
)
inline

Make a subdirectory in the volume working directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.
[in]pFlagCreate missing parent directories if true.
Returns
The value true is returned for success and the value false is returned for failure.
bool FatFileSystem::remove ( const char *  path)
inline

Remove a file from the volume working directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the file.
Returns
The value true is returned for success and the value false is returned for failure.
bool FatFileSystem::rename ( const char *  oldPath,
const char *  newPath 
)
inline

Rename a file or subdirectory.

Parameters
[in]oldPathPath name to the file or subdirectory to be renamed.
[in]newPathNew path name of the file or subdirectory.

The newPath object must not exist before the rename call.

The file to be renamed must not be open. The directory entry may be moved and file system corruption could occur if the file is accessed by a file object that was opened before the rename() call.

Returns
The value true is returned for success and the value false is returned for failure.
bool FatFileSystem::rmdir ( const char *  path)
inline

Remove a subdirectory from the volume's working directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.

The subdirectory file will be removed only if it is empty.

Returns
The value true is returned for success and the value false is returned for failure.
bool FatFileSystem::truncate ( const char *  path,
uint32_t  length 
)
inline

Truncate a file to a specified length. The current file position will be maintained if it is less than or equal to length otherwise it will be set to end of file.

Parameters
[in]pathA path with a valid 8.3 DOS name for the file.
[in]lengthThe desired length for the file.
Returns
The value true is returned for success and the value false is returned for failure.
FatVolume* FatFileSystem::vol ( )
inline
Returns
a pointer to the FatVolume object.
FatFile* FatFileSystem::vwd ( )
inline
Returns
a pointer to the volume working directory.
bool FatFileSystem::wipe ( print_t pr = 0)
inline

Wipe all data from the volume. You must reinitialize the volume before accessing it again.

Parameters
[in]prprint stream for status dots.
Returns
true for success else false.

The documentation for this class was generated from the following file: