Enumerations | Functions
FindDirectory.h File Reference

Provides the find_directory function. More...

Enumerations

enum  directory_which {
  B_DESKTOP_DIRECTORY = 0,
  B_TRASH_DIRECTORY,
  B_SYSTEM_DIRECTORY = 1000,
  B_SYSTEM_ADDONS_DIRECTORY = 1002,
  B_SYSTEM_BOOT_DIRECTORY,
  B_SYSTEM_FONTS_DIRECTORY,
  B_SYSTEM_LIB_DIRECTORY,
  B_SYSTEM_SERVERS_DIRECTORY,
  B_SYSTEM_APPS_DIRECTORY,
  B_SYSTEM_BIN_DIRECTORY,
  B_SYSTEM_DOCUMENTATION_DIRECTORY = 1010,
  B_SYSTEM_PREFERENCES_DIRECTORY,
  B_SYSTEM_TRANSLATORS_DIRECTORY,
  B_SYSTEM_MEDIA_NODES_DIRECTORY,
  B_SYSTEM_SOUNDS_DIRECTORY,
  B_SYSTEM_DATA_DIRECTORY ,
  B_COMMON_DIRECTORY = 2000 ,
  B_COMMON_DEVELOP_DIRECTORY,
  B_COMMON_LOG_DIRECTORY ,
  B_COMMON_DATA_DIRECTORY,
  B_COMMON_CACHE_DIRECTORY ,
  B_USER_DIRECTORY = 3000 ,
  B_USER_SETTINGS_DIRECTORY,
  B_USER_DESKBAR_DIRECTORY
}
 Directory constants to use with find_directory. More...

Functions

status_t find_directory (directory_which which, dev_t volume, bool createIt, char *pathString, int32 length)
 C interface to find_directory.
status_t find_directory (directory_which which, BPath *path, bool createIt=false, BVolume *volume=NULL)
 C++ interface to find_directory.

Detailed Description

Provides the find_directory function.

Haiku provides a set of directories for applications to use. These can be accessed using the find_directory function. It is very important to use the function at runtime and not hardcode the path, as it may change in future versions of Haiku, and already changed in past ones. Using this function makes your application more future-proof, and makes sure everyone puts data in the same place, which makes the system cleaner and easier to manage.

Note this function can be accessed from C code, to make it easy to use also in ported applications.


Enumeration Type Documentation

Directory constants to use with find_directory.

There are four kind of directories. Volume-local directories exist on each volume. They may be at a different place in each of them, for example the trash location depends on the filesystem. System and common directories are system-wide. They live on only one volume. The difference is system is only meant for internal system management and shouldn't be used by applications. The common directories have a similar hierarchy, and they are ignored when the user disable user add-ons in the boot menu. User directories have a different value depending on the UID of the application calling the function. They are usually located in the user home directory.

Use common directories for system-wide filessuch as drivers. Use user directories for application settings, since each user may want different settings.

Enumerator:
B_DESKTOP_DIRECTORY 

The desktop for a given volume.

B_TRASH_DIRECTORY 

The trash for a given volume.

B_SYSTEM_DIRECTORY 

The system directory.

B_SYSTEM_ADDONS_DIRECTORY 

The system add-ons directory

B_SYSTEM_BOOT_DIRECTORY 

The system boot directory. Contains the minimal set of files required for booting Haiku.

B_SYSTEM_FONTS_DIRECTORY 

The system fonts directory

B_SYSTEM_LIB_DIRECTORY 

The system lib directory.

B_SYSTEM_SERVERS_DIRECTORY 

The system servers directory.

B_SYSTEM_APPS_DIRECTORY 

The system applications direcotry. Contains applications executable from Tracker.

B_SYSTEM_BIN_DIRECTORY 

The system bin directory. Contains command-line applications runnable from Terminal.

B_SYSTEM_DOCUMENTATION_DIRECTORY 

The system documentation directory. Contains manpages.

B_SYSTEM_PREFERENCES_DIRECTORY 

The system preferences directory.

B_SYSTEM_TRANSLATORS_DIRECTORY 

The system translator directory.

B_SYSTEM_MEDIA_NODES_DIRECTORY 

The system media nodes directory.

B_SYSTEM_SOUNDS_DIRECTORY 

The system sounds directory.

B_SYSTEM_DATA_DIRECTORY 

The system data directory.

B_COMMON_DIRECTORY 

The common directory.

B_COMMON_DEVELOP_DIRECTORY 

The common development directory. Contains toolchains, include files, and other tools related to application development.

B_COMMON_LOG_DIRECTORY 

The common log directory. Log files are stored here.

B_COMMON_DATA_DIRECTORY 

The common data directory. You may store application data here, such as resources (graphics, music) for your application.

B_COMMON_CACHE_DIRECTORY 

The common cache directory. You may store temporary data here, such as thumbnails for a picture viewer application, or a web browser data cache.

B_USER_DIRECTORY 

The user home directory. Do NOT store application settings here as on unix, instead use B_USER_SETTINGS_DIRECTORY.

B_USER_SETTINGS_DIRECTORY 

The user settings directory. You may store your application settings here. Create a subdirectory for your application if you have multiple files to store, else, put a single file. The file or directory should have the same name as your application, so the user knows what it's used for.

B_USER_DESKBAR_DIRECTORY 

The user deskbar directory. You may add a link to your application here, so it shows up in the user deskbar's leaf menu.


Function Documentation

status_t find_directory ( directory_which  which,
dev_t  volume,
bool  createIt,
char *  pathString,
int32  length 
)

C interface to find_directory.

Fills up to length characters of pathString with the path to which on volume. Creates the directory if it doesn't exists and creqteIt is set.

status_t find_directory ( directory_which  which,
BPath path,
bool  createIt = false,
BVolume volume = NULL 
)

C++ interface to find_directory.

Set path to which on volume.


The Haiku Book pre-R1 - FindDirectory.h File Reference
Generated on Sun May 19 2013 by Doxygen 1.7.5.1