Modified for BG96
Fork of mbed-dev by
Diff: platform/FilePath.cpp
- Revision:
- 187:0387e8f68319
- Parent:
- 182:a56a73fd2a6f
--- a/platform/FilePath.cpp Fri Jun 22 16:45:37 2018 +0100 +++ b/platform/FilePath.cpp Thu Sep 06 13:40:20 2018 +0100 @@ -17,11 +17,12 @@ namespace mbed { -FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) { +FilePath::FilePath(const char *file_path) : file_name(NULL), fb(NULL) +{ // skip slashes file_path += strspn(file_path, "/"); - const char* file_system = file_path; + const char *file_system = file_path; file_name = file_system; int len = 0; while (true) { @@ -41,37 +42,45 @@ fb = FileBase::lookup(file_system, len); } -const char* FilePath::fileName(void) { +const char *FilePath::fileName(void) +{ return file_name; } -bool FilePath::isFileSystem(void) { - if (NULL == fb) +bool FilePath::isFileSystem(void) +{ + if (NULL == fb) { return false; + } return (fb->getPathType() == FileSystemPathType); } -FileSystemLike* FilePath::fileSystem(void) { +FileSystemLike *FilePath::fileSystem(void) +{ if (isFileSystem()) { - return static_cast<FileSystemLike*>(fb); + return static_cast<FileSystemLike *>(fb); } return NULL; } -bool FilePath::isFile(void) { - if (NULL == fb) +bool FilePath::isFile(void) +{ + if (NULL == fb) { return false; + } return (fb->getPathType() == FilePathType); } -FileLike* FilePath::file(void) { +FileLike *FilePath::file(void) +{ if (isFile()) { - return (FileLike*)fb; + return (FileLike *)fb; } return NULL; } -bool FilePath::exists(void) { +bool FilePath::exists(void) +{ return fb != NULL; }