open_from() now also supports absolute paths, in which case it will ignore
the passed in directory. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7513 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
429fb127d3
commit
259fd3cdfb
|
@ -583,7 +583,7 @@ write(int fd, const void *buffer, size_t bufferSize)
|
||||||
int
|
int
|
||||||
open(const char *name, int mode, ...)
|
open(const char *name, int mode, ...)
|
||||||
{
|
{
|
||||||
// we always start at the top
|
// we always start at the top (there is no notion of a current directory (yet?))
|
||||||
if (name[0] == '/')
|
if (name[0] == '/')
|
||||||
name++;
|
name++;
|
||||||
|
|
||||||
|
@ -601,8 +601,11 @@ open(const char *name, int mode, ...)
|
||||||
int
|
int
|
||||||
open_from(Directory *directory, const char *name, int mode)
|
open_from(Directory *directory, const char *name, int mode)
|
||||||
{
|
{
|
||||||
if (name[0] == '/')
|
if (name[0] == '/') {
|
||||||
return B_BAD_VALUE;
|
// ignore the directory and start from root if we are asked to do that
|
||||||
|
directory = gRoot;
|
||||||
|
name++;
|
||||||
|
}
|
||||||
|
|
||||||
Node *node;
|
Node *node;
|
||||||
if (get_node_for_path(directory, name, &node) < B_OK)
|
if (get_node_for_path(directory, name, &node) < B_OK)
|
||||||
|
|
Loading…
Reference in New Issue