Lines Matching defs:FilePath

45 	const std::string FilePath::separator = "\\";
47 const std::string FilePath::separator = "/";
50 FilePath::FilePath (const std::vector<std::string>& components)
60 void FilePath::split (std::vector<std::string>& components) const
84 FilePath& FilePath::normalize (void)
135 FilePath FilePath::normalize (const FilePath& path)
137 return FilePath(path).normalize();
140 std::string FilePath::getBaseName (void) const
147 std::string FilePath::getDirName (void) const
154 return FilePath(components).getPath();
162 std::string FilePath::getFileExtension (void) const
172 bool FilePath::exists (void) const
174 FilePath normPath = FilePath::normalize(*this);
180 FilePath::Type FilePath::getType (void) const
182 FilePath normPath = FilePath::normalize(*this);
198 bool FilePath::beginsWithDrive (void) const
210 bool FilePath::isAbsolutePath (void) const
217 DE_TEST_ASSERT(!FilePath(".").isAbsolutePath());
218 DE_TEST_ASSERT(!FilePath("..\\foo").isAbsolutePath());
219 DE_TEST_ASSERT(!FilePath("foo").isAbsolutePath());
220 DE_TEST_ASSERT(FilePath("\\foo/bar").isAbsolutePath());
221 DE_TEST_ASSERT(FilePath("/foo").isAbsolutePath());
222 DE_TEST_ASSERT(FilePath("\\").isAbsolutePath());
223 DE_TEST_ASSERT(FilePath("\\\\net\\loc").isAbsolutePath());
224 DE_TEST_ASSERT(FilePath("C:\\file.txt").isAbsolutePath());
225 DE_TEST_ASSERT(FilePath("c:/file.txt").isAbsolutePath());
227 DE_TEST_ASSERT(string(".") == FilePath(".//.").normalize().getPath());
228 DE_TEST_ASSERT(string(".") == FilePath(".").normalize().getPath());
229 DE_TEST_ASSERT((string("..") + FilePath::separator + "test") == FilePath("foo/../bar/../../test").normalize().getPath());
230 DE_TEST_ASSERT((FilePath::separator + "foo" + FilePath::separator + "foo.txt") == FilePath("/foo\\bar/..\\dir\\..\\foo.txt").normalize().getPath());
231 DE_TEST_ASSERT((string("c:") + FilePath::separator + "foo" + FilePath::separator + "foo.txt") == FilePath("c:/foo\\bar/..\\dir\\..\\foo.txt").normalize().getPath());
232 DE_TEST_ASSERT((FilePath::separator + FilePath::separator + "foo" + FilePath::separator + "foo.txt") == FilePath("\\\\foo\\bar/..\\dir\\..\\foo.txt").normalize().getPath());
234 DE_TEST_ASSERT(FilePath("foo/bar" ).getBaseName() == "bar");
235 DE_TEST_ASSERT(FilePath("foo/bar/" ).getBaseName() == "bar");
236 DE_TEST_ASSERT(FilePath("foo\\bar" ).getBaseName() == "bar");
237 DE_TEST_ASSERT(FilePath("foo\\bar\\" ).getBaseName() == "bar");
238 DE_TEST_ASSERT(FilePath("foo/bar" ).getDirName() == "foo");
239 DE_TEST_ASSERT(FilePath("foo/bar/" ).getDirName() == "foo");
240 DE_TEST_ASSERT(FilePath("foo\\bar" ).getDirName() == "foo");
241 DE_TEST_ASSERT(FilePath("foo\\bar\\" ).getDirName() == "foo");
259 FilePath dirPath = FilePath::normalize(path);
260 FilePath parentPath (dirPath.getDirName());
266 else if (parentPath.getType() != FilePath::TYPE_DIRECTORY)
275 FilePath curPath (path);
286 curPath = FilePath(parent);