Added BPath::IsAbsolute() method.

This commit is contained in:
Axel Dörfler
2012-11-05 12:50:03 +01:00
parent 09d87d9151
commit 9e42a44cad
2 changed files with 17 additions and 4 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _PATH_H
@@ -47,6 +47,7 @@ public:
const char* Path() const;
const char* Leaf() const;
status_t GetParent(BPath* path) const;
bool IsAbsolute() const;
bool operator==(const BPath& item) const;
bool operator==(const char* path) const;
+13 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Haiku Inc.
* Copyright 2002-2012, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,11 +7,13 @@
* Ingo Weinhold, [email protected]
*/
/*!
\file Path.cpp
BPath implementation.
*/
#include <Path.h>
#include <new>
@@ -402,6 +404,16 @@ BPath::GetParent(BPath* path) const
}
bool
BPath::IsAbsolute() const
{
if (InitCheck() != B_OK)
return false;
return fName[0] == '/';
}
/*! \brief Performs a simple (string-wise) comparison of paths.
No normalization takes place! Uninitialized BPath objects are considered
to be equal.