Fixes the autoload_namespaces generator 

This fixes issue #2186 by doing a check on the path after the substr and only exporting it's value if it is not false.