Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.33
diff -u -p -r1.33 path.inc
--- includes/path.inc	3 Apr 2009 17:41:32 -0000	1.33
+++ includes/path.inc	26 Apr 2009 04:33:03 -0000
@@ -262,3 +262,30 @@ function drupal_match_path($path, $patte
   }
   return (bool)preg_match($regexps[$patterns], $path);
 }
+
+/**
+ * Returns the current path alias of the page being viewed if any, otherwise
+ * its current URL path
+ *
+ * Example #1: When viewing http://example.com/path/alias, this function
+ * would return "path/alias".
+ *
+ * Example #2: When viewing http://example.com/node/306, if that node
+ * has path alias of 'path/alias', this function would return "path/alias".
+ *
+ * Example #2: When viewing http://example.com/drupalfolder/node/306 this
+ * function would still return "path/alias" and base_path() would return
+ * "/drupalfolder/".
+ *
+ * NOTE: This function is not available in hook_boot and you should use
+ * $_GET['q'] instead. Calling drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH) makes
+ * this function available with a return value of "path/alias" or
+ * "node/306" if no path alias is set for that node.
+ *
+ * @return
+ *   The current Drupal path alias if any, otherwise the current URL path.
+
+ */
+function current_path_alias() {
+  return drupal_get_path_alias($_GET['q']);
+}
