http://files.filefront.com/Portable+CB+5409+bin7z/;13536157;/fileinfo.htmlEdit 1: If you download this package, extract it to a folder and then double click on cblauncher.exe file.
D:\portableCB
├─AppData
│ ├─codeblocks
│ └─share
│ └─codeblocks
│ ├─plugins
│ └─scripts
└─share
└─CodeBlocks
├─images
│ ├─16x16
│ ├─codecompletion
│ ├─codesnippets
│ ├─settings
│ ├─ThreadSearch
│ └─wxsmith
├─lexers
├─lib_finder
├─plugins
├─scripts
└─templates
......
......
#define _WIN32_WINNT 0x0500
......
......
HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd,SW_HIDE);
I download your binary package and unpack to my nightly build folder which is located in D:\program files\code blocks.
Then I just run CbLauncher.exe, it will create an empty folder in
D:\Program Files\CodeBlocks\AppData\codeblocks
And even I close C::B, no setting files were saved in these folders. This is a little strange. :(. Should I need to clear the setting file in:
"C:\Documents and Settings\[your_user_name]\Application Data\codeblocks"?
But as you said, some plug-in setting can't be work in full portable mode. :(
By the way, I suggest when the portable version was running, the console window should be closed.
And another issue it the about dialog shows that it is SVN 0. :D
CodeD:\portableCB
├─AppData
│ ├─codeblocks
│ └─share
│ └─codeblocks
│ ├─plugins
│ └─scripts
└─share
└─CodeBlocks
├─images
│ ├─16x16
│ ├─codecompletion
│ ├─codesnippets
│ ├─settings
│ ├─ThreadSearch
│ └─wxsmith
├─lexers
├─lib_finder
├─plugins
├─scripts
└─templates
......
......
Before testing, I delete the folder
C:\Documents and Settings\My name\Application Data\codeblocks
But once the CbLauncher.exe runs, the folder will be automatically generated again. :(.
By the way, I also find another folder here, ( I just deleted it, maybe, it is related to the bug you have fixed. :D)
C:\Documents and Settings\My name\AppData\codeblocks
By the way, I have found the way to hide the console window.
Add this statement:Code#define _WIN32_WINNT 0x0500
......
......
HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd,SW_HIDE);
[/quote]Before testing, I delete the folder
C:\Documents and Settings\My name\Application Data\codeblocks
But once the CbLauncher.exe runs, the folder will be automatically generated again. :(.
By the way, I also find another folder here, ( I just deleted it, maybe, it is related to the bug you have fixed. :D)
C:\Documents and Settings\My name\AppData\codeblocks
I noticed this too. It's strange that C::B is still generating a folder inside C:\Documents and Settings folder. Need to investigate further.
...
Before testing, I delete the folder
C:\Documents and Settings\My name\Application Data\codeblocks
But once the CbLauncher.exe runs, the folder will be automatically generated again. :(.
By the way, I also find another folder here, ( I just deleted it, maybe, it is related to the bug you have fixed. :D)
C:\Documents and Settings\My name\AppData\codeblocks
I noticed this too. It's strange that C::B is still generating a folder inside C:\Documents and Settings folder. Need to investigate further.
...
CodeSnippets may be doing that. In the old days, it used to crash on first run of Codeblocks because the config folder was not created yet.
I'll have a look.
I meet a bug in portable c::b.
I just click Menu->Settings->Editor, then c::B will crash. :(
Edit:
I revert to "nightly build version" and no crash there :D
http://files.filefront.com/Portable+CB+5526+bin7z/;13582845;/fileinfo.html
I've uploaded a new binary to the following link.Quotehttp://files.filefront.com/Portable+CB+5526+bin7z/;13582845;/fileinfo.html
Package comes with an updated launcher. New launcher is tagged as v0.1.1. Previous bug reported by OllyDbg have been fixed. Also now console window will be closed after launching C::B.
Edit:
I'm not sure you encountered the problem: dragging the toolbar vertically will make CB crash. :( This bug exists for many months.
I think the CbLauncher.exe 0.11 version should be uploaded so the people don't need to download the whole package from:
http://files.filefront.com/Portable+CB+5526+bin7z/;13582845;/fileinfo.html
http://biplab.in/2009/04/creating-portable-codeblocks-part-2/
@echo off
echo Setting environment variables and checking for directories availability:
:: Get the current batch fille drive and set it as homedrive
for %%x in (%0) do set HOMEDRIVE=%%~dsx
set HOMEDRIVE
:: Set user as USERNAME
set USERNAME=user
set USERNAME
:: Set \home\%USERNAME% as HOMEPATH and assure the directory exists
mkdir %HOMEDRIVE%\home
set HOMEPATH=\home\%USERNAME%
set HOMEPATH
mkdir %HOMEDRIVE%%HOMEPATH%
mkdir "%HOMEDRIVE%%HOMEPATH%\Desktop
:: Set %HOMEDRIVE%%HOMEPATH% as USERPROFILE
set USERPROFILE=%HOMEDRIVE%%HOMEPATH%
set USERPROFILE
::set %HOMEDRIVE%%HOMEPATH%\ApplicationData as APPDATA
set APPDATA=%HOMEDRIVE%%HOMEPATH%\ApplicationData
set APPDATA
mkdir %APPDATA%
:: Set %HOMEDRIVE%\home\AllUsers as ALLUSERSPROFILE and assure it exists
set ALLUSERSPROFILE=%HOMEDRIVE%\home\AllUsers
set ALLUSERSPROFILE
mkdir %ALLUSERSPROFILE%
echo Adding %HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks to the PATH
set PATH=%HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks;%PATH%
set PATH
CALL cmd.exe
I made a small batch file which temporarily modifies essential environment variables to make "portable" version not only for codeblocks but also msys and mingw.
Assuming that you have copied the tools to /MingW and /msys and /codeblocks on your usb you can copy the following script to eg portable.bat on your usb.
After running this bat file, just type codeblocks and everything should work fine - if it touches configuration files, it uses the locations within USB.
Be sure you set $(CODEBLOCKS)/../Mingw as the location for the gcc toolchain.
You can also change cmd.exe to codeblocks.exe in the last line of this batch file to start codeblocks immediately.Code@echo off
echo Setting environment variables and checking for directories availability:
:: Get the current batch fille drive and set it as homedrive
for %%x in (%0) do set HOMEDRIVE=%%~dsx
set HOMEDRIVE
:: Set user as USERNAME
set USERNAME=user
set USERNAME
:: Set \home\%USERNAME% as HOMEPATH and assure the directory exists
mkdir %HOMEDRIVE%\home
set HOMEPATH=\home\%USERNAME%
set HOMEPATH
mkdir %HOMEDRIVE%%HOMEPATH%
mkdir "%HOMEDRIVE%%HOMEPATH%\Desktop
:: Set %HOMEDRIVE%%HOMEPATH% as USERPROFILE
set USERPROFILE=%HOMEDRIVE%%HOMEPATH%
set USERPROFILE
::set %HOMEDRIVE%%HOMEPATH%\ApplicationData as APPDATA
set APPDATA=%HOMEDRIVE%%HOMEPATH%\ApplicationData
set APPDATA
mkdir %APPDATA%
:: Set %HOMEDRIVE%\home\AllUsers as ALLUSERSPROFILE and assure it exists
set ALLUSERSPROFILE=%HOMEDRIVE%\home\AllUsers
set ALLUSERSPROFILE
mkdir %ALLUSERSPROFILE%
echo Adding %HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks to the PATH
set PATH=%HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks;%PATH%
set PATH
CALL cmd.exe
@Rokan,
I haven't tried this. But having a complete development environment should be nice to many users. Thanks for sharing this.
@OllyDbg,
So far CbLauncher does the similar thing before launching Code::Blocks. Assuming the batch file is error free, you do not need CbLauncher.exe v0.1.1 to make C::B portable. You can use this batch file.
By the way, comparing a batch file with a exe file, I do prefer the former one, because it can be easily add to trunk. :D
By the way, comparing a batch file with a exe file, I do prefer the former one, because it can be easily add to trunk. :D
You are forgetting that exe file has a corresponding source file which should not be difficult to add to trunk. Nobody will add a exe file to trunk unless absolutely necessary.
Thanks.
My question is:
Do I need the "CBLuncher.exe" supplied by BipLab to run CB?
Or I just type codeblocks.exe as you said?
Thanks. :D
@echo off
echo Setting environment variables and checking for directories availability:
:: Get the current batch fille drive and set it as homedrive
for %%x in (%0) do set HOMEDRIVE=%%~dsx
set HOMEDRIVE
:: Set user as USERNAME
set USERNAME=user
set USERNAME
:: Set \Documents and Settings\%USERNAME% as HOMEPATH and assure the directory exists
set HOMEPATH=\Documents and Settings\%USERNAME%
set HOMEPATH
mkdir "%HOMEDRIVE%%HOMEPATH%"
mkdir "%HOMEDRIVE%%HOMEPATH%\Desktop"
:: Set %HOMEDRIVE%%HOMEPATH% as USERPROFILE
set USERPROFILE=%HOMEDRIVE%%HOMEPATH%
set USERPROFILE
::set "%HOMEDRIVE%%HOMEPATH%\Application Data" as APPDATA
set APPDATA=%HOMEDRIVE%%HOMEPATH%\Application Data
mkdir "%APPDATA%"
set APPDATA
:: Set %HOMEDRIVE%\home\All Users as ALLUSERSPROFILE and assure it exists
set ALLUSERSPROFILE=%HOMEDRIVE%\Documents and settings\All Users
mkdir "%ALLUSERSPROFILE%"
mkdir "%ALLUSERSPROFILE%\Application Data"
echo Preppending %HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks to the PATH
set PATH=%HOMEDRIVE%\MinGW\bin;%HOMEDRIVE%\msys\1.0\bin;%HOMEDRIVE%\codeblocks;%PATH%
start codeblocks.exe
cmd.exe
Here is modified script expecting MinGW, msys, and codeblocks directories as before:Notice that this script won't work on non-English Windows platforms.
I have found a bug in codeblocks: It does not use APPDATA to store various .ini files, instead it uses hard-codded "Application Data" subdirectory within users directory, which causes messing the root (on USB) with various files.
@Biplab: Did you commit the sources for CbLauncher, too? I could not find them... Or do I need to use the one from the archive?
No I didn't commit source of CbLauncher. It can be downloaded from my blog. If others have no objection, I can commit it to trunk.You can submit the tool in the "tools" sub-folder in src.
BTW: How does that work under Linux? If I got the changes right they are Windows only and under Linux it still uses the standard path's which would be not on (e.g.) a USB stick...?!
#!/bin/sh
xhost +
export HOME=`pwd`
./run.sh
xhost -
No I didn't commit source of CbLauncher. It can be downloaded from my blog. If others have no objection, I can commit it to trunk.You can submit the tool in the "tools" sub-folder in src.
BTW: How does that work under Linux? If I got the changes right they are Windows only and under Linux it still uses the standard path's which would be not on (e.g.) a USB stick...?!
By the way:
Instead of dealing with APPDATA and HOME (that seems to be a little hacky), it would be better (in my opinion) to pass an alternative conf-dir to C::B as start-parameter and provide a sdk-function that returns the actual used conf-dir (for the plugins or whatever needs it).
Using well defined environment variable to save configuration is a standard procedure.
I have found a bug in codeblocks: It does not use APPDATA to store various .ini files, instead it uses hard-codded "Application Data" subdirectory within users directory, which causes messing the root (on USB) with various files. As a work-arround I have modified the directories on USB to look like "standard windows" ones (although I prefer short unix-like ones where you do not need to type quotes to get around that stupid spaces). The script launches codeblocks.exe and also command prompt with all variables set - where you can eg launch real bash shell from msys by typing "sh". Here is modified script expecting MinGW, msys, and codeblocks directories as before:
@Biplab
I found another bug. See the steps I wrote in this post:
http://forums.codeblocks.org/index.php/topic,10599.msg73602.html#msg73602
For a reminder, I added this to
3.2 Q: How do I make Code::Blocks portable? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F)
Also, I suggest that these codes can be add to SVN trunk. Thanks.
3- If applications used by CB "Tools" or "Plugins" are located in a "tool"
subdirectory of the CodeBlocks installation root directory or subdirectories, then
the "tool" directory and its subdirectories are added to the system path prior to
launching Code::Blocks.
I have checked the Windows Registry with Regshot 1.8.2 before and after run the portable version: this build write various key inThis is true but only happens if you select this option in a C::B dialog asking you so (register file extensions) and can be done at any time again through C::B's options. That's the only registry use to my knowledge and also just because there is no other choice. So: You can safely ignore this part for a portable install and leave it to the user's decision.
HKU\...\Software\Classes\CodeBlocks.* (various files extension) or
HKU\..._Classes\CodeBlocks.* (various files extensions).
This is true but only happens if you select this option in a C::B dialog asking you so (register file extensions) and can be done at any time again through C::B's options. That's the only registry use to my knowledge and also just because there is no other choice. So: You can safely ignore this part for a portable install and leave it to the user's decision.Thank for Your info.
A reminder.For a reminder, I added this to
3.2 Q: How do I make Code::Blocks portable? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F)
Also, I suggest that these codes can be add to SVN trunk. Thanks.
Thanks for reminding. I haven't got time to update it. Nevertheless I'll merge it to trunk soon. :)
Portable CbLauncher is updated to v0.1.4thanks!!!
The launcher is becoming mature. Version 0.1.3 was extensively used with the only issue that it was not passing command-line arguments to Code::Blocks.
Report any issue with 0.1.4 here (Biplab's blog has not been updated for a long time).
Download source, docs and exe: http://www.filesonic.com/file/36969763/CbLauncher_0.1.4.zip
History:
* v-0.1.4 - November 2010
* - Commandline arguments are now passed on to Codeblocks.
* - Complete doxygen documentation
* - Streamlined code
*
* v-0.1.3 - April 2010
* - Added optional portable CB tool path (optionally enables portable programming utilities)
* - Launcher icon added
* - Console hidden in release build, visible in debug build
*
* v-0.1.2 - April 2010
* - Added optional portable CB fonts path (optionally allows fully portable programmer fonts for the editor)
* - Console now hidden
*
* v-0.1.1 - 14 April 2009
* - Update on Biplab's blog, see http://biplab.in/2009/04/creating-portable-codeblocks-part-2/
*
* v-0.1 - 5 April 2009
* - First release on Biplab's blog, see http://biplab.in/2009/04/creating-portable-version-of-codeblocks/
can some body just download it and share it to another site? thanks
thanks, this site works fine!!!can some body just download it and share it to another site? thanks
Alternate download (slow, but no captcha to enter): http://cblauncher.codecutter.net/CbLauncher_0.1.4.zip
Portable CbLauncher is updated to v0.1.4
The launcher is becoming mature. Version 0.1.3 was extensively used with the only issue that it was not passing command-line arguments to Code::Blocks.
Report any issue with 0.1.4 here (Biplab's blog has not been updated for a long time).
Download source, docs and exe: http://www.filesonic.com/file/36969763/CbLauncher_0.1.4.zip
History:
* v-0.1.4 - November 2010
* - Commandline arguments are now passed on to Codeblocks.
* - Complete doxygen documentation
* - Streamlined code
*
* v-0.1.3 - April 2010
* - Added optional portable CB tool path (optionally enables portable programming utilities)
* - Launcher icon added
* - Console hidden in release build, visible in debug build
*
* v-0.1.2 - April 2010
* - Added optional portable CB fonts path (optionally allows fully portable programmer fonts for the editor)
* - Console now hidden
*
* v-0.1.1 - 14 April 2009
* - Update on Biplab's blog, see http://biplab.in/2009/04/creating-portable-codeblocks-part-2/
*
* v-0.1 - 5 April 2009
* - First release on Biplab's blog, see http://biplab.in/2009/04/creating-portable-version-of-codeblocks/
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)I think "icons\codeblocks.ico" should be replaced by the C::B's.
the icon of the cblauncher is not as good as the codeblocks.exe.
where is C::B's icon.(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)I think "icons\codeblocks.ico" should be replaced by the C::B's.
the icon of the cblauncher is not as good as the codeblocks.exe.
I think so.where is C::B's icon.(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)I think "icons\codeblocks.ico" should be replaced by the C::B's.
the icon of the cblauncher is not as good as the codeblocks.exe.
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/src/resources/icons/app.ico
this one?
I think so.agreed.
A reminder.For a reminder, I added this to
3.2 Q: How do I make Code::Blocks portable? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F)
Also, I suggest that these codes can be add to SVN trunk. Thanks.
Thanks for reminding. I haven't got time to update it. Nevertheless I'll merge it to trunk soon. :)
Hi, biplab, did you forget to add your cblauncher code to trunk?
I have used it for about one year. :D
... I noticed some commit which makes C::B portable without any launcher. Then I stopped working further.
But I do believe that a separate launcher will be useful. Thus I want to merge it to trunk.
Do you remember what commits you saw that made CB portable without any launcher? I have not seen that.I guess it is loaden's patch to make codeblocks.exe portable. The patch can be downloaded from loaden's site:
I guess it is loaden's patch to make codeblocks.exe portable. The patch can be downloaded from loaden's site:The patch works well if you don't need codesnippets or cb_share_config.
http://code.google.com/p/portablecb/
maybe this one:
portablecb.patch (http://portablecb.googlecode.com/files/portablecb.patch)
Hi Ollydbg
1- Changes to the Codeblocks working environment (including the PATH variable) made by the launcher last only until Codeblocks exits.
While Codeblocks is working these changes are effective only for this instance of Codeblocks and for the tools (apps or shells) started by this instance.
If you want permanent changes to the system and changes that are effective outside Codeblocks (for example a permanent change to the path) this is not the responsibility of the launcher. You'd have to apply the changes to your user or system variables outside Codeblocks.
It is essential to remember that any changes that are made in a command window only endure until the window is closed. For permanent changes, use the method discussed in another section. It is also possible to use the command-line executable setx.exe that is contained in the Windows XP Service Pack 2 Support Tools.
I'll change that variable name in the next version.nice to hear.
it said:QuoteIt is essential to remember that any changes that are made in a command window only endure until the window is closed. For permanent changes, use the method discussed in another section. It is also possible to use the command-line executable setx.exe that is contained in the Windows XP Service Pack 2 Support Tools.
it said:QuoteIt is essential to remember that any changes that are made in a command window only endure until the window is closed. For permanent changes, use the method discussed in another section. It is also possible to use the command-line executable setx.exe that is contained in the Windows XP Service Pack 2 Support Tools.
Replace "command window" with "command shell" in the quote and it would be correct. We have no "command window" in the release target.
There is no need to actively change the path back because the path is only valid while the shell that starts Codeblocks is going and that shell ends when Codeblocks ends.
The same is not the case for the programmer fonts that are added to the system by the launcher. These need to be actively removed when CB exits because they are not part of the current working environment but of the global Windows system.
New version available:
* v-0.1.5 January 2011
* - Fixed: Application directory incorrectly detected if launcher called by selecting a
* source file with the mouse (\\AppData was created in wrong directory, etc...).
* - A new default icon contains higher resolution icons (requested by olydbg). The cost
* is a significantly larger executable size.
* - The CBLauncher icon can now be distinguished from the Codeblocks icon.
* - Optionally: To reduce the executable size at the cost of a rougher icon, you can
* copy "lores.ico" to "launcher.ico" prior to building.
* - Optionally: To further reduce the launcher size, compress it with UPX.
* - Programmer fonts now also added from any ..\\share\\codeblocks\\fonts\\.. subdirectory.
* This enables placing font families and their licence files each in their own directory.
* - .otf (postcript OpenType fonts) now also added if present in font directories.
* - Some debug messages were modified.
* - Pre-built doxygen html documentation is now added to the distribution
* (see in ..Others\doc\html\index.html).
*
Download link 1:
http://www.filesonic.com/file/51551777/CbLauncher_0.1.5.zip (http://www.filesonic.com/file/51551777/CbLauncher_0.1.5.zip)
Download link 2:
cblauncher.codecutter.net/CbLauncher_0.1.5.zip (http://cblauncher.codecutter.net/CbLauncher_0.1.5.zip)
:: Change to the directory that this batch file is in
:: NB: it must be invoked with a full path!
for /f %%i in ("%0") do set curpath=%%~dpi
echo %curpath%
cmd
I can't download this package... the link is broken??
I can't download this package... the link is broken??
ok now, thanks!!!I can't download this package... the link is broken??
It's there now. I had to implement a "last minute" change.
The launcher has now had heavy testing as part of the Code::Blocks EDU-Portable educational distribution at http://codeblocks.codecutter.orgHi,
There has been no sign of instability of this latest version.
The latest version of the portable CB launcher is out:@codeur
http://CbLauncher.codecutter.org/CbLauncher_1.0.zip
v-1.0 March 2011
* Tool path and fonts set up to only occur when Codeblocks is not already running.
* Launcher stable, now tested under a variety of Windows platforms from XP onwards.
The launcher has now had heavy testing as part of the Code::Blocks EDU-Portable educational distribution at http://codeblocks.codecutter.org
There has been no sign of instability of this latest version.
Biplab if that is OK with you, I think now is a good time to commit the portable CB launcher to the contrib folder.
@codeur
I found in the launcher.cpp, there is a function called "bool isCodeblocksRunning()" to avoid running two instances of the portable c::b. what's the purpose of this?
I just do a flesh install (unzip the nightly build 7075 and cb portable launcher 1.0).@codeur
I found in the launcher.cpp, there is a function called "bool isCodeblocksRunning()" to avoid running two instances of the portable c::b. what's the purpose of this?
This function only detects if CB is already running. It is NOT used to prevent starting multiple instances of codeblocks. That last is controlled, as you say, by Codeblocks itself.
isCodeblocksRunning() is called elsewhere in the launcher to avoid multiple attempts at loading the same programmer fonts into the system.
Most users run CB in single-instance mode which is the default, so this area of the launcher is not as thoroughly tested as the rest.
Is this piece of code causing any trouble?
@ollydbgOk, tested and it works fine! thanks!!!.
Please check if launcher v1.0.1 (exec only) from http://cblauncher.codecutter.org/CbLauncher1.0.1.zip (53 kB) fixes that issue for you.
Biplab or other developer, please commit to contrib when you have time.
Copyright (C) 2009-2011 Biplab Kumar Modakto-
Copyright (C) 2009-2011 codeur (codeur@codeur.com)
Copyright (C) 2009 Biplab Kumar Modak
I'll commit it to trunk over the next weekend.I guess it would fit best under src\tools\CBLauncher (or cb_launcher...).
I'll commit it to trunk over the next weekend.I guess it would fit best under src\tools\CBLauncher (or cb_launcher...).
@Biplab
The v1.0.1 CbLauncher archive at codecutter.org has been updated with the changes to copyright you suggested.
I suggest however committing the same, except without the exe.
You can download that from http://CbLauncher.codecutter.org/CbLauncher_1.0.1_src.zip (334 kb)
Thanks.
nice, waiting this for about one year more.... :wink:@Biplab
The v1.0.1 CbLauncher archive at codecutter.org has been updated with the changes to copyright you suggested.
I suggest however committing the same, except without the exe.
You can download that from http://CbLauncher.codecutter.org/CbLauncher_1.0.1_src.zip (334 kb)
Thanks.
I have added it to trunk; in revision 7125.
This will not be built by default. So whoever needs it has to build it by opening Project file inside tools\CBLauncher folder.
Please feel free to post patches towards improving it. :)