Added BEntry::Name() method.
* GetName() is a bad API, and should be deprecated.
This commit is contained in:
parent
a2f6e5ac9c
commit
b20073726a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ENTRY_H
|
||||
@ -50,6 +50,8 @@ public:
|
||||
status_t InitCheck() const;
|
||||
bool Exists() const;
|
||||
|
||||
const char* Name() const;
|
||||
|
||||
virtual status_t GetStat(struct stat* stat) const;
|
||||
|
||||
status_t SetTo(const BDirectory* dir, const char* path,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009, Haiku Inc.
|
||||
* Copyright 2002-2012, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -191,6 +191,16 @@ BEntry::Exists() const
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
BEntry::Name() const
|
||||
{
|
||||
if (fCStatus != B_OK)
|
||||
return NULL;
|
||||
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BEntry::SetTo(const BDirectory* dir, const char* path, bool traverse)
|
||||
{
|
||||
@ -360,18 +370,13 @@ BEntry::GetParent(BDirectory* dir) const
|
||||
status_t
|
||||
BEntry::GetName(char* buffer) const
|
||||
{
|
||||
status_t result = B_ERROR;
|
||||
if (fCStatus != B_OK)
|
||||
return B_NO_INIT;
|
||||
if (buffer == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (fCStatus != B_OK) {
|
||||
result = B_NO_INIT;
|
||||
} else if (buffer == NULL) {
|
||||
result = B_BAD_VALUE;
|
||||
} else {
|
||||
strcpy(buffer, fName);
|
||||
result = B_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
strcpy(buffer, fName);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user