I used Christoph's fix, because it works as is. And since future upgrades will require a new search and replace with either approach, maybe this is the most sensible solution. At least until the future possibility of something similar being implemented into the bakery core.
But I didn't given up on your idea, because I think it would be a helpful addition.
Here's what I did to get it working.
added your code to the bottom of the bakery/config.php file:
// name of the bakery image folder in media
$sBakeryImgFolder = 'products'; //no leading/trailing slash or backslash!! A simple directory name only!!
Renamed my media/bakery folder to media/products
Did a search (Find in Files) with Notepad++ for all instances of (31 total in 8 files):
MEDIA_DIRECTORY.'/bakeryand replaced with:
There are two files which require different replace formatting
'save_item.php' ~line 278
MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.notice the difference, there is no single quote between MEDIA_DIRECTORY.'/'.$sBakeryImgFolder. <and> $directory;
uninstall.php ~line 52
MEDIA_DIRECTORY.'/'.$sBakeryImgFoldernotice the difference, there is no trailing single quote or concatenation.
I took a look at the OneForAll module files and the calls are to the info.php for the module name '$mod_name' - to complete the media folder path.
There are two files which aren't displaying the images in bakery with the above settings in place, modify.php and view_overview.php
I added the following to those two files (near the top, although I do not know if placement matters), and it now everything seems to work:
// Get some default values
But I do not know enough to know if this is all something that should be done, or what effect it might have. But it was fun working it out.