# Delete folder on extension update

I've created a script.php which contains the following function:

protected function update400()
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

JFolder::delete(JPATH_ROOT . '/media/mod_MYMODULE/js');
}

This function is then called inside Joomla's predefined preflight(). The function is getting, called, however upon installation, I get the following error:

JInstaller: :Install: File does not exist C:\wamp\www\tmp\install_53de639f7a0b6\400\media\js

At first I thought this was because I was calling update400() from the preflight() function, so I tried calling it from the postflight() function instead, however this did not make any difference.

What I'm trying to figure out, is why it's looking in the tmp folder when I have specifically defined the path.

Does anyone know why this is happening?