Allan Odgaard-4 wrote:
On 2 Feb 2010, at 21:30, John Wiederhirn wrote:
[...] unfortunately it's fairly easy to wind up with an "untitled.h" in your temp directory that then subsequently blocks all further generation of C/C++/Obj-C templates of any kind. The issue isn't tied to multi-file templates either, even single-file templates that check for file existence can trigger this problem.
It should only be for multi-file templates, as TextMate will do the check for single-file templates, and “bump” the untitled counter until there is a free spot. It can’t do that for multi-file templates because it only knows the name of one of the files generated (so that is the one it ensures does not already exist).
Okay, I'm confused, I thought one of the things you were trying to avoid was having "noisy" names pulled into the templates for subsequent usage, so was trying to avoid that totally. However, if you're okay with the user having to change stuff like UNTITLED_2_H, then why is changing TM1002022340_H worse? In either cases, it's a search and replace situation, no? <p> I'd have an easier time with just having the user delete the files in the temp folder if it were easily accessible from Finder (or even Terminal), but /var/folder/cT/cTlongtextgibberish/-Tmp-/ really isn't friendly to user-access, period. Heck I'd even be okay with just always deleting the questionable file in -Tmp-, but that's hard in a template script precisely because the untitled basename _does_ potentially change. You kind of wind up needing to know whether the basename was auto-generated or not to safely make that call. <p> BTW, that would be another workaround, just set an env var you hand to the template building script set to 1 or 0 depending on whether basename was auto-generated (file->new from template) or not. Then templates know they're in the -Tmp- dir, and thus whether they can overwrite any colliding files "safely". <p> Since you've made your position clear, though, I'll drop it. I look forward to 2.0 when hopefully multi-file templates (very useful for C, C++ and Obj-C "starter patterns") will be reliably useful. Thanks again.