Edit: I don't quite get it though. I have 2 instances of CB open. I double click a .cbp file (with DDE server off) and it launches a new, 3rd CB. So what's the gotcha?
The gotcha is this:
You may not want to use 10 different editors. I use Code::Blocks not only as a full IDE, but also as a plain editor for about everything
(except for HTML, because there is not browser preview).
So you have a file open inside Code::Blocks and do something else (look up something on the web, for example, or answer the phone). Maybe you completely forget about Code::Blocks for an entire hour or two.
So any time later, you double-click on this file you wish to modify. This is quite intuitive because the Explorer window containing the file is still open. However, Code::Blocks is minimised, which you forgot about.
So what happens is you see your file opened in Code::Blocks, you work on, and ten minutes later, you realize that you have been working on two copies, neither of which is consistent.
The same can happen if you add new files to a project or change the build settings.
The idea with tempfiles in KNOWN_LOCATION would have the advantage that it is simple. Not good, but simple. Every system can create temp files, no DDE, OLE, or whatever obscure Microsoft-proprietary technology needed to make it work on Windows (and sadly, wx seems to rely on DDE).
True enough, TCP sockets are a much better solution, but like I pointed out, these may give people running an application-layer firewall on Windows an unneeded bad feeling. Most people I know get quite nervous when they suddenly see "Do you want to allow XXX to act as a server?" or "Do you want to allow XXX to access the internet?".
The problem with leftover files is not as bad as you picture it, really. Adobe Photoshop regularly leaves behind tempfiles on the order of 90-130 megabytes, and few people ever notice. Who would complain about a file which is, say 30 bytes in size.
The only question is what to do with leftover files from the application's PoV.
Lets see what can happen:
1. application starts, no other instance is running
---> no temp file is created. app does
rm KNOWN_FOLDER/* to clean up (just to be sure)
---> everybody is happy
2. application starts, sees another instance, creates tempfile, signals other instance, exits
--->other instance opens all files that are newer than a threshold (say 1-2 seconds?), executes the requested
commands, and does
rm KNOWN_FOLDER/*---> everybody is happy
3. application starts, sees another instance, creates tempfile, but
crashes---> no one knows about the tempfile, but no one cares, either
---> next time the tempfile is deleted anyway
---> the user is angry because the app crashed, but nothing else happens
4. application starts, sees another instance, creates tempfile, signals and exits, but
other instance crashes---> no one knows about the tempfile, but no one cares, either
---> the user is angry because the app crashed, but nothing else happens
So this does not look so bad, does it? A tempfile older than a second or two can safely be ignored, as we only start looking at them when receiving a signal (and that really does not take a long time to propagate). And since we "own" KNOWN_FOLDER, we can delete whatever we find in it, too.