Code::Blocks Forums

User forums => Help => Topic started by: Pecan on October 26, 2014, 01:18:59 am

Title: Open filename on command line
Post by: Pecan on October 26, 2014, 01:18:59 am
Can someone tell this thick headed self how to open a file on the command line:

I've tried "codeblocks.exe c:\this.is.a.file"
and
"codeblocks.exe --file=c:\this.is.a.file"

neither works for me.


svn build  rev 9936 (2014-10-10 14:00:08)   gcc 4.6.1 Windows/unicode - 32 bit
Title: Re: Open filename on command line
Post by: stahta01 on October 26, 2014, 01:24:58 am
This almost worked for me.

Code
codeblocks.exe --file="C:\Temp\this.is.a.file"

It got a CB error of
---------------------------
Error
---------------------------
Could not open file C:\Temp\this.is.a.file,
because no extension handler could be found.
---------------------------
OK  
---------------------------

I get the same error with this.
Code
codeblocks.exe --file=C:\Temp\this.is.a.file

Windows 7 32 bit.

Added c file extension and this command worked on opening it in CB

Code
codeblocks.exe --file=C:\Temp\this.is.a.file.c


Tim S.
Title: Re: Open filename on command line
Post by: scarphin on October 26, 2014, 02:04:32 am
Maybe the file extension should be inserted to cb's extension handler to point to the internal editor? Just a guess!
Title: Re: Open filename on command line
Post by: Pecan on October 29, 2014, 06:39:20 pm
Reading the code(thanks for the hint staht01), CB will only handle certain extentions for which it has handler to open the files.

I circumvented the code with a personal hack, and am happy I can use CB for a generalized editor now.
Title: Re:
Post by: MortenMacFly on October 29, 2014, 07:52:36 pm
Well a proper solution would be to show the same dialog we do show in case you open a file without extension handler from the file open dialog.