Where does mysql write temporary tables? MySQL 5.1.x | Windows Server 2008

Data Directory is on a different partition.

I have an innodb database (innodb_file_per_table is set) that I'm trying to optimize and I don't appear to have enough space.  When I run the optimize command, I see: 

foodb.foo_table
note      : Table does not support optimize, doing recreate + analyze instead
error     : The table '#sql-123_foo' is full
status    : Operation failed


My understanding is that when I run OPTIMIZE TABLE, it's essentially running ALTER TABLE behind the scenes and that usually needs to make a copy of the table.  My question is, where is the table being created?
From the MySQL manual for 5.1:

..
On Windows, Netware and OS2, MySQL checks in order the values of the TMPDIR, TEMP, and TMP environment variables. For the first one found to be set, MySQL uses it and does not check those remaining. If none of TMPDIR, TEMP, or TMP are set, MySQL uses the Windows system default, which is usually C:\windows\temp.
..
ALTER TABLE creates a temporary copy of the original table in the same directory as the original table.

In newer MySQL versions it gets a bit more complicated to explain because there is also an in-place fast ALTER TABLE, but for 5.1 the answer to your question is simply &quot;in the table's directory&quot;.