User forums > Using Code::Blocks
How to auto open files with an external program?
TerryP:
I've tried searching the forum but it doesn't seem to turn anything up. In short, I want the IDE to auto open certain file types using an associated external program, whenever I double click the file in the managers projects tab. That should be fairly obvious from the topics title.
However as much as I've seen by poking around the UI, it's required to right click and use the 'open with' to reach that. Whether or not it's possible to create a toolbar button or keyboard shortcut to open the currently selected file with an external tool instead of the file extension handler or internal editor, I would consider that kind of solution to be side stepping something that should logically be built into the IDE, or a user demonstrating their level of brain damage \o/. The value of auto running a program on double click ranges from using an external code editor, to viewing attached image files, and well beyond. I doubt the internal code/hex editors were designed to handle every possible type of file, and there's no valid excuse for having to be explicit every time you want to open a file with a different program. Visual C++ can handle this type of configuration fairly well but rather lacks Code::Blocks portability, in both several senses of the word ^_^.
Since Code::Blocks has grown a scripting language since our last date (Cica 2005), it occurs to me to ask: is it possible to make a script (or even a plugin) that could enforce using a the file extension handler on the double click of a file in the manager window, rather then auto opening it in the IDEs editor? The stuff on the wiki is a bit, disappointing.
If not, the only things I can think of, is building my own binaries with a personal patch set to add it by force, or finding a more mature tool then Code::Blocks.
stahta01:
If inside Code::Blocks the MIME Plugin does this.
If outside Code::Blocks the operating system does the clicks.
Tim S.
TerryP:
Where can I find this "MIME" plugin? There doesn't appear to be anything by that name in the files I installed, like wise searches of Forum, Wiki, and Google yield nothing of value. Anything I define in "Settings -> Environment -> File extension handling" are only respected when telling Code::Blocks context menu, to open it that way instead of with the internal editor.
Jenna:
"Settings -> Environment... -> File extension handling"
TerryP:
Well then, unless *.extension is not a suitable wild card for all cases, there must be more to it then that. As a test, I've tried defining two file extensions:
*.c - set to open with associated application; it opens in the internal editor on double click.
*.png - set to open with associated application; it opens with the windows default on double click.
So it would seem, this problem only applies to file extensions built in. That could make it potentionally difficult, for sake of example, to use the internal editor for Java code but an external editor for C++ files. I want the file associations to work irregardless of whether the file extension is known to Code::Blocks already, perhaps a more indepth wild card is needed?
My apologies are apparently due, because the first tests I conducted were overriding *.cpp and *.c files before moving on to other file types. (Well, testing against C/C++ files is the most obvious thing to try first after all... since C::B targets the language most strongly)
Is it possible to get it working with 'all' file types set?
Navigation
[0] Message Index
[#] Next page
Go to full version