added error checking for long path names on Windows (will shorten); can turn off on Macs