1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) {
21 if ((file_path[0] != '/') || (file_path[1] == 0)) return;
23 const char* file_system = &file_path[1];
24 file_name = file_system;
28 if (c == '/') { // end of object name
29 file_name++; // point to one char after the '/'
32 if (c == 0) { // end of object name, with no filename
39 fb = FileBase::lookup(file_system, len);
42 const char* FilePath::fileName(void) {
46 bool FilePath::isFileSystem(void) {
49 return (fb->getPathType() == FileSystemPathType);
52 FileSystemLike* FilePath::fileSystem(void) {
54 return (FileSystemLike*)fb;
59 bool FilePath::isFile(void) {
62 return (fb->getPathType() == FilePathType);
65 FileLike* FilePath::file(void) {
72 bool FilePath::exists(void) {