Path to theme, module, or library - drupal_get_path ()

There are many instances where you need to get the path to a theme, a module or a library. Here are some possible methods:

Path to Current Theme

<?php
//$GLOBALS['theme'] gives you the name of the current theme
$sThemePath = drupal_get_path('theme',$GLOBALS['theme']);
?>

WARNING: Looking up the path to a specific theme should be avoided as the logic will not allow correct function with anything but the specific theme. Hardcoding a theme name should be avoided, use $GLOBALS['theme'] instead.
Warning 2: path_to_theme() does not quite give you what you think it does. Read the documentation carefully
http://api.drupal.org/api/drupal/includes%21theme.inc/function/path_to_t...

Path to Module

<?php
 $sModulePath
= drupal_get_path('module', 'moduleNameGoesHere');
?>

Path to Library

<?php
//Notice, this is NOT the drupal_get_path function.
$sLibraryPath = libraries_get_path('machineNameOfLibraryGoesHere');
?>

Reference

http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_get...
http://drupalcontrib.org/api/drupal/contributions!libraries!libraries.mo...

section: