path_to_theme() return "modules/system" I am trying to render the theme logo as a block.

When I call path_to_theme() in page.tpl.php, it returns a true path, but when I call it in modulename.module, it returns "modules/system".
Whenever I'm stuck in a module, or a context that path_to_theme() doesn't return what I'd like - I use the following to access the current globally selected theme.

global $theme;
$path_to_theme = drupal_get_path('theme',$theme);


For instance if I am in a subtheme, or a slighly different flavour (mobile vs. desktop) of my theme, I use $theme that to get my active theme.