Added BPath::IsAbsolute() method.
This commit is contained in:
@@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _PATH_H
|
#ifndef _PATH_H
|
||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
const char* Path() const;
|
const char* Path() const;
|
||||||
const char* Leaf() const;
|
const char* Leaf() const;
|
||||||
status_t GetParent(BPath* path) const;
|
status_t GetParent(BPath* path) const;
|
||||||
|
bool IsAbsolute() const;
|
||||||
|
|
||||||
bool operator==(const BPath& item) const;
|
bool operator==(const BPath& item) const;
|
||||||
bool operator==(const char* path) const;
|
bool operator==(const char* path) const;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2009, Haiku Inc.
|
* Copyright 2002-2012, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,11 +7,13 @@
|
|||||||
* Ingo Weinhold, [email protected]
|
* Ingo Weinhold, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file Path.cpp
|
\file Path.cpp
|
||||||
BPath implementation.
|
BPath implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
#include <new>
|
#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.
|
/*! \brief Performs a simple (string-wise) comparison of paths.
|
||||||
No normalization takes place! Uninitialized BPath objects are considered
|
No normalization takes place! Uninitialized BPath objects are considered
|
||||||
to be equal.
|
to be equal.
|
||||||
|
|||||||
Reference in New Issue
Block a user