I am developing an extension, which can be installed by copying the extension folder into Magento folder. This extension includes a folder within Magento media folder, which should be writable by Magento. Since the folder can be copied with the rights different from the rights, which Magento runs on, I am looking for the way of creating this folder in the setup script.
It looks like a bad practice to me to run this code within the script for sql or entity setup. Is there any way in Magento to do such task in appropriate setup script or should I make the perfectionist in me shut up and simply put the code in the sql setup script?
You can use Varien_Io_File::checkAndCreateFolder() to check and create directory not in setup script, but in the place of the actual usage of the folder.