file_directory_path() doesn't exist in drupal 7 - except under certain conditions

in

I was just about to release the Drupal 7 version of Development Banner a few days ago, I got an error trying to install it on a local site during final testing:

Fatal error: Call to undefined function file_directory_path() in /var/www/html/sandbox/public/7.x/sites/all/modules/cowork/dev_banner/dev_banner.module on line 83

Ooops, I was using an older version that was before I replaced calls to file_directory_path() with file_default_scheme(). But this same version worked without an error on another server, using the same older version of the code.

Why didn't I get the error on the other server? I know file_directory_path() isn't part of Drupal 7, yet I got no error. Turns out the function is included under at least one certain condition. The culprit was that I had included the Code Review module, which does define this function in coder_upgrade.inc:

if (!function_exists('file_directory_path')) {
  function file_directory_path($scheme = 'public') {
  ...

I understand why it's there, but it wasn't immediately obvious what was going on.

Lesson learned: when testing a module for release, use a minimal Drupal test site (ideally freshly installed).

I made minimal installs of both D6 and D7 and put them in a git repo, so I could pull them down for testing whenever I need one. But duh, I did my release testing on a built out side. Sometimes lessons are learned the hard way!