Adobe ExtendScript File object gotcha under OS X Lion

File this under Ultra-Niche. If you happen to be one of the three people in the world using Adobe's easy-to-use and powerful ExtendScript to script the CS*-series of tools (e.g., Photoshop) and you're using the FIle object to write out files manually, read on.

Under Snow Leopard, the following code would work (you'll find variants of this code floating around the Internets):

var cssFile = new File();
cssFile.open('w');
cssFile.write(css);
cssFile.copy(cssFilePath);

In OS X Lion, it doesn't. Instead use:

var cssFile = new File(cssFilePath);
cssFile.open('w');
cssFile.write(css);
cssFile.close();

Hope this helps the one dudette in Sweden who runs across the issue in 2013 :)

Comments