1 //----------------------------------------------------------------------
2 // This software is part of the Haiku distribution and is covered
4 //---------------------------------------------------------------------
6 \file FindDirectory.cpp
7 find_directory() implementations.
10 #include <FindDirectory.h>
16 //! Returns a path of a directory specified by a directory_which constant.
17 /*! \param which the directory_which constant specifying the directory
18 \param path a BPath object to be initialized to the directory's path
19 \param createIt \c true, if the directory shall be created, if it doesn't
20 already exist, \c false otherwise.
21 \param volume the volume on which the directory is located
23 - \c B_OK: Everything went fine.
24 - \c B_BAD_VALUE: \c NULL \a path.
28 find_directory(directory_which which
, BPath
* path
, bool createIt
,
34 dev_t device
= (dev_t
)-1;
35 if (volume
&& volume
->InitCheck() == B_OK
)
36 device
= volume
->Device();
38 char buffer
[B_PATH_NAME_LENGTH
];
39 status_t error
= find_directory(which
, device
, createIt
, buffer
,
42 error
= path
->SetTo(buffer
);