OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 public: | 43 public: |
44 static const char separator; | 44 static const char separator; |
45 static const char root[]; | 45 static const char root[]; |
46 | 46 |
47 // Returns the name part from the given path. | 47 // Returns the name part from the given path. |
48 static String getName(const String& path); | 48 static String getName(const String& path); |
49 | 49 |
50 // Returns the parent directory path of the given path. | 50 // Returns the parent directory path of the given path. |
51 static String getDirectory(const String& path); | 51 static String getDirectory(const String& path); |
52 | 52 |
53 // Checks if a given path is a parent of mayBeChild. This method assumes given
paths are absolute and do not have extra references to a parent (i.e. "../"). | 53 // Checks if a given path is a parent of mayBeChild. This method assumes given |
| 54 // paths are absolute and do not have extra references to a parent (i.e. |
| 55 // "../"). |
54 static bool isParentOf(const String& path, const String& mayBeChild); | 56 static bool isParentOf(const String& path, const String& mayBeChild); |
55 | 57 |
56 // Appends the separator at the end of the path if it's not there already. | 58 // Appends the separator at the end of the path if it's not there already. |
57 static String ensureDirectoryPath(const String& path); | 59 static String ensureDirectoryPath(const String& path); |
58 | 60 |
59 // Returns a new path by appending a separator and the supplied path component
to the path. | 61 // Returns a new path by appending a separator and the supplied path component |
| 62 // to the path. |
60 static String append(const String& path, const String& component); | 63 static String append(const String& path, const String& component); |
61 | 64 |
62 static bool isAbsolute(const String& path) { | 65 static bool isAbsolute(const String& path) { |
63 return path.startsWith(DOMFilePath::root); | 66 return path.startsWith(DOMFilePath::root); |
64 } | 67 } |
65 | 68 |
66 static bool endsWithSeparator(const String& path) { | 69 static bool endsWithSeparator(const String& path) { |
67 return path[path.length() - 1] == DOMFilePath::separator; | 70 return path[path.length() - 1] == DOMFilePath::separator; |
68 } | 71 } |
69 | 72 |
70 // Evaluates all "../" and "./" segments. Note that "/../" expands to "/", so
you can't ever refer to anything above the root directory. | 73 // Evaluates all "../" and "./" segments. Note that "/../" expands to "/", so |
| 74 // you can't ever refer to anything above the root directory. |
71 static String removeExtraParentReferences(const String& path); | 75 static String removeExtraParentReferences(const String& path); |
72 | 76 |
73 // Checks if the given path follows the FileSystem API naming restrictions. | 77 // Checks if the given path follows the FileSystem API naming restrictions. |
74 static bool isValidPath(const String& path); | 78 static bool isValidPath(const String& path); |
75 | 79 |
76 // Checks if the given name follows the FileSystem API naming restrictions. | 80 // Checks if the given name follows the FileSystem API naming restrictions. |
77 static bool isValidName(const String& name); | 81 static bool isValidName(const String& name); |
78 }; | 82 }; |
79 | 83 |
80 } // namespace blink | 84 } // namespace blink |
81 | 85 |
82 #endif // DOMFilePath_h | 86 #endif // DOMFilePath_h |
OLD | NEW |