Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Biplab on April 05, 2009, 04:04:17 pm

Title: Portable Code::Blocks
Post by: Biplab on April 05, 2009, 04:04:17 pm
Hi All,

I've made a patch against current svn revision to make Code::Blocks portable. A slightly detailed write-up on this can be found from my blog (http://biplab.in/2009/04/creating-portable-version-of-codeblocks/ (http://biplab.in/2009/04/creating-portable-version-of-codeblocks/)).

With this patch anyone should be able to carry customised C::B settings by copying entire folder of Code::Blocks and plugins settings from %APPDATA%\codeblocks folder, place it to a folder and then pointing it by modifying APPDATA variable before launching C::B.

I've written a small utility which will create an folder structure AppData\codeblocks from the directory it is launched. Then it'll modify APPDATA variable before launching Code::Blocks from same folder.

Now you can copy your entire content of %APPDATA%\codeblocks to AppData\codeblocks folder and copy the folder to any portable drive. Everytime you run codeblocks through cblauncher, your settings will be saved to the folder you are running from. If you don't copy your settings and run C::B through cblauncher it will assume that it's a fresh install and will behave accordingly.

I've created a binary package from revision 5409 to try this out. You can download it from the following link.
Quote
http://files.filefront.com/Portable+CB+5409+bin7z/;13536157;/fileinfo.html
Edit 1: If you download this package, extract it to a folder and then double click on cblauncher.exe file.

I've not applied this patch to svn. However I intend to do so if other devs have no objection to this hack.

Patch is attached with this post. CbLauncher source and binary can be downloaded from my blog.

Please post your valuable feedback.

Regards,

Biplab

[attachment deleted by admin]
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 06, 2009, 03:14:32 pm
I have read your blog article, and I have two binary package in my system. One is nightly build version, the other is the version I build from the svn.

To let the two version work separately, I follow the wiki page:
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F

But as you said, some plug-in setting can't be work in full portable mode. :(

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"?

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

See the screen shot.



[attachment deleted by admin]
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 06, 2009, 03:44:03 pm
I upzip your binary package to D:\PortableCB.

The First time I run CbLauncher.exe, it seems no C::B was running, only an empty folder named AppData was generated.

The second time I run CbLauncher.exe, it will initialize C::B, then after I close C::B, some configuration files were saved in D:\portableCB\AppData\XXX, also, two sub folders were generated.

Here is the folder tree. Is it right?
Code: [Select]
D:\portableCB

├─AppData
│  ├─codeblocks
│  └─share
│      └─codeblocks
│          ├─plugins
│          └─scripts
└─share
    └─CodeBlocks
        ├─images
        │  ├─16x16
        │  ├─codecompletion
        │  ├─codesnippets
        │  ├─settings
        │  ├─ThreadSearch
        │  └─wxsmith
        ├─lexers
        ├─lib_finder
        ├─plugins
        ├─scripts
        └─templates
        ......
        ......

Thanks!
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 06, 2009, 04:39:00 pm
By the way, I have found the way to hide the console window.

Add this statement:

Code: [Select]
#define _WIN32_WINNT 0x0500
......
......


HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd,SW_HIDE);


Thanks
Title: Re: Portable Code::Blocks
Post by: Biplab on April 06, 2009, 04:53:26 pm
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"?

It's a bug in CbLauncher. I've fixed it. You can replace your cblauncher.exe file with the attached one. I'll reupload binary package with new cblauncher.exe file.

But as you said, some plug-in setting can't be work in full portable mode. :(

I have tried with few plugins (DevPak, DragScroll). They are saving their settings to APPDATA pointed directory. But honestly I haven't checked all.

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

Noted. I'll make this change. Don't worry about SVN 0. It's built from rev 5409. I built this build from source tarball and therefore svn failed to generate any revision number.

Code: [Select]
D:\portableCB

├─AppData
│  ├─codeblocks
│  └─share
│      └─codeblocks
│          ├─plugins
│          └─scripts
└─share
    └─CodeBlocks
        ├─images
        │  ├─16x16
        │  ├─codecompletion
        │  ├─codesnippets
        │  ├─settings
        │  ├─ThreadSearch
        │  └─wxsmith
        ├─lexers
        ├─lib_finder
        ├─plugins
        ├─scripts
        └─templates
        ......
        ......

Folder structure is correct. Your settings will be saved under AppData folder. Share folder is being used to load various resources.

Thanks a lot for your feedback. :)


[attachment deleted by admin]
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 06, 2009, 05:12:57 pm
You are welcome!

I just downloaded the new CbLauncher.exe in the previous post.

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

Title: Re: Portable Code::Blocks
Post by: Biplab on April 06, 2009, 05:24:28 pm
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.

By the way, I have found the way to hide the console window.

Add this statement:

Code: [Select]
#define _WIN32_WINNT 0x0500
......
......


HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd,SW_HIDE);


Please feel free to download the source of CbLauncher and tweak it as you like. At the moment need to go to bed. I will apply your modification later. :)
Title: Re: Portable Code::Blocks
Post by: Pecan on April 07, 2009, 04:33:16 pm
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.

...
[/quote]

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.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 07, 2009, 05:20:50 pm
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.

Thanks a lot Pecan. Hope to hear from you soon. :)
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 08, 2009, 03:44:52 pm
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
Title: Re: Portable Code::Blocks
Post by: Biplab on April 08, 2009, 06:05:48 pm
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

This was due to a make dist bug. As I generated source tarball and then compiled it, and in generated source tarball one resource file was missing. That was causing this crash.

I'm attaching a new resource file. Download & Paste it inside share\codeblocks folder and crash will vanish.

At the moment I don't have time to reupload a new binary (It's almost midnight here). Tomorrow I'll try to make a clean build and reupload it. :)

[attachment deleted by admin]
Title: Re: Portable Code::Blocks
Post by: Biplab on April 11, 2009, 05:32:55 pm
I've uploaded a new binary to the following link.

Quote
http://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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 11, 2009, 05:48:04 pm
I've uploaded a new binary to the following link.

Quote
http://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.

Thanks for your effort. I will download and test it. :D

Edit:
I'm not sure you encountered the problem: dragging the toolbar vertically will make CB crash. :( This bug exists for many months.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 13, 2009, 05:39:58 pm
Edit:
I'm not sure you encountered the problem: dragging the toolbar vertically will make CB crash. :( This bug exists for many months.

I didn't experience this crash.

I've committed this patch to trunk. You'll be able to download next nightly and use CbLauncher to run Code::Blocks in a portable manner.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 14, 2009, 03:36:35 am
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

About the dragging toolbar crash:
I still meet this crash every time :(. So frustrated.

In the post, mmkider suggested using an old wxWidgets DLL, but this crash still exists in wxWidgets DLL 2.8.10. :(
http://forums.codeblocks.org/index.php/topic,9648.msg67823.html#msg67823

Title: Re: Portable Code::Blocks
Post by: mrTeoc on April 14, 2009, 03:40:26 am
This is great! I really needed this, because I get to work on random pcs very often.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 14, 2009, 06:01:55 am
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

I've uploaded it to my blog. You can download it from the following link-

Quote
http://biplab.in/2009/04/creating-portable-codeblocks-part-2/

I've also written steps to launch C::B nightlies (> rev 5534) in a portable manner using CbLauncher in the above post.
Title: Re: Portable Code::Blocks
Post by: rokan1 on April 16, 2009, 05:16:28 pm
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: [Select]
@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


Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2009, 05:29:50 pm
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: [Select]
@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


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
Title: Re: Portable Code::Blocks
Post by: Biplab on April 16, 2009, 05:37:59 pm
@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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2009, 05:44:24 pm
@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.

Thanks for the quick response. :D I will try it.

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
Title: Re: Portable Code::Blocks
Post by: Biplab on April 16, 2009, 05:50:57 pm
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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2009, 05:58:25 pm
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.

Oh, yes. I really forget that. :D
I notices that there is an DLL file named "exchndl.dll" in the trunk\src\, I'm not sure why we need this file :shock:.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 16, 2009, 06:00:48 pm
exchndl.dll is used generate crash report for Code::Blocks on Windows.
Title: Re: Portable Code::Blocks
Post by: rokan1 on April 16, 2009, 11:06:38 pm

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

No, you do not need CBLuncher.exe and all that jazz, just unpack standard codeblocks  (eg from nightly builds) to /codeblocks directory on USB

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:

Code: [Select]

@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


Title: Re: Portable Code::Blocks
Post by: MortenMacFly on April 17, 2009, 01:14:50 am
Here is modified script expecting MinGW, msys, and codeblocks directories as before:
Notice that this script won't work on non-English Windows platforms.

@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?
Title: Re: Portable Code::Blocks
Post by: Biplab on April 17, 2009, 02:00:13 am
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.

Code::Blocks now uses APPDATA to save configuration files. Download a nightly (Rev > 5534) which will have this modification.


@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.
Title: Re: Portable Code::Blocks
Post by: MortenMacFly on April 17, 2009, 07:10:14 am
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...?!
Title: Re: Portable Code::Blocks
Post by: jens on April 17, 2009, 10:50:14 am
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...?!

On linux a simple script should be enough.

I just hacked one to use C::B compiled with C::B.

Put the following script inside the folder where the run.sh-script is and start it.
You might have to deal with LD_LIBRARY_PATH for a wxWidgets-installation, if you need to have it on the stick (or whatever), too.
But that's another thing and makes it not so easy to make C::B portable on linux.

If you have a C::B installed on the machine and all you want is to have portable configuration, you can use a call to codeblocks instead of running run.sh.

Code: [Select]
#!/bin/sh

xhost +
export HOME=`pwd`
./run.sh
xhost -

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).
Title: Re: Portable Code::Blocks
Post by: Biplab on April 19, 2009, 06:11:25 am
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...?!

I'll put that code in trunk.

Creating portable version on Linux is not easy. I mean you build binary on Fedora and then you can't expect that it will run fine on other system, e.g. Ubuntu. Yes, it's possible to ask Code::Blocks to save configuration file to any specified folder. I have made this change only for Windows where many people prefer portable application.


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).

Both way it's a hack. If you use APPDATA or HOME, you are asking Code::Blocks to use another directory by pointing to by modifying corresponding environmental variables locally. On the other hand if we provide it as an option, we are still asking it to use another folder as the configuration folder. Using well defined environment variable to save configuration is a standard procedure.
Title: Re: Portable Code::Blocks
Post by: jens on April 19, 2009, 12:31:20 pm
Using well defined environment variable to save configuration is a standard procedure.

Nothing to say against that.

What I mean is to use APPDATA and HOME as default, but give the user the flexibility to change the conf-dir via commandline.

And if it should be done with environment variables, it is not the correct way to change variables that are set by the OS (even not temporary).
In this case we should use an own variable (maybe only if it is set and as default use the system standard).

To avoid that plugins, that are distributed with C::B, still use the system standard dirs, we should offer a function to provide the actual used directory and not hack the environment.
And "teach" them to use it.
Title: Re: Portable Code::Blocks
Post by: Omnipotent Geass on May 20, 2009, 07:16:33 pm
I don't see why you couldn't save application data in file and have an option in code::blocks to modify where that data is saved because I my self would like a completely portable code::blocks yet it dose not appear to have much use to me as why would you be developing an application on other person/entity's computer other than your own unless you are wanting to compile bit of code that you might find.
Title: Re: Portable Code::Blocks
Post by: ollydbg on June 21, 2009, 04:44:34 am
Quote
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:

I can confirm this bug.

I have many *.ini file next to codeblocks.exe. when I run CbLauncher.exe, it will use these ini files. (though I have a subfolder called "APPDATA" next to codeblocks.exe)

When I delete the *.ini file and run Cblauncher.exe again.
All the layout will be reconfigured. Quite STRANGE.
Title: Re: Portable Code::Blocks
Post by: ollydbg on June 21, 2009, 03:07:05 pm
@Biplab
I found another bug. See the steps I wrote in this post:

http://forums.codeblocks.org/index.php/topic,10599.msg73602.html#msg73602

Thanks.
Title: Re: Portable Code::Blocks
Post by: Biplab on June 21, 2009, 04:02:38 pm
@Biplab
I found another bug. See the steps I wrote in this post:

http://forums.codeblocks.org/index.php/topic,10599.msg73602.html#msg73602

Thanks for reporting this bug. However it seems that it's a bug in CodeSnippets plugin. I'll look into the other bug.
Title: Re: Portable Code::Blocks
Post by: ollydbg on June 21, 2009, 04:06:13 pm
It seems this bug has happened only once (in the first configure step).

After that, I can delete "codesnippets.ini" in the root folder, and it won't happened again when I run portable CB. :D

 
Title: Re: Portable Code::Blocks
Post by: washington678 on July 08, 2009, 04:51:40 am

Hello everyone. Nice to meet you all.



pret auto (http://pret-auto.org)
Title: Re: Portable Code::Blocks
Post by: ollydbg on December 05, 2009, 05:03:23 am
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.
Title: Re: Portable Code::Blocks
Post by: Biplab on December 05, 2009, 05:54:15 am
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. :)
Title: Re: Portable Code::Blocks
Post by: Denro on August 18, 2010, 10:07:45 am
i did download CbLauncher0.1.3
and i did all as http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F said ... also with bat file

now in the launcher doc is writen
Quote
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.

do i have to make a directory "tool" in the C::B install root folder and place all plugins and tools in that folder?

also i did download all the dejavu fonts and place them into the share\CodeBlocks\fonts folder
is it OK if i place all the fonts there or should it be only one font?

and in the APPDIR i have a template folder ... do i have to move it now to the C::B main directory or what?
there are also some other files in the APPDIR ... what i do with them

maybe all gets clear if i start C::B with the launcher
but i wait now some minutes ... maybe someone will motivate me or tell me what i have to do with this template folder and the other files in the APPDIR :)
Title: Re: Portable Code::Blocks
Post by: Denro on August 18, 2010, 07:02:22 pm
i did download the last nighltly C::B build
and minGW
i did download the lastest C::B portable launcher from http://biplab.in/2009/04/creating-portable-codeblocks-part-2/
and also the Dejavu fonts from http://dejavu-fonts.org
and i did all as described here http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F

I have put the minGW folder into the C::B mainfolder "codeblocks\mingw"
and the fonts to "codeblocks\share\CodeBlocks\fonts"

i had to run C::B and to compile the C::B portable launcher wich comes as a C::B project

the Launcher binary i placed i the C::B root folder "codeblocks\"
and all the files in "%APPDATA%\codeblocks\" i moved to the C::B application directory "codeblocks\"
(there were some files in subfolders which i placed at the corresponding folder in the C::B application folder)

i did rename the "%APPDATA%\codeblocks\" to "_CB_"
and launch the portable launcher

and C::B did load finaly as normal :D with all my settings and as ever :D


i have not tested all the plugins and hope most of them will work too in that way ;)

there is one thing that is buging me :(
in the enviroment settings i can tell C::B where the helpfiles are
and the phat looks like "C:\Program Files\CodeBlocks\share\CodeBlocks\docs\codeblocks.chm"
can i do this relative?
and if i have tools will i face the same problem? can i make the tools path also portable (relative) if i put the tools into the C::B folder?
the launcher instruction is not very clear to me ... sorry!

if any other person wanna try it ... just do as i did and it will work as far as possible :D

thanks for this cool launcher ;)
Title: Re: Portable Code::Blocks
Post by: rbon on August 25, 2010, 12:56:11 pm
Here is the Code::Blocks portable launcher CbLauncher0.1.3 with exe.zip (http://www.4shared.com/file/os1iuAYF/CbLauncher013_with_exe.html)
Title: Re: Portable Code::Blocks
Post by: rbon on August 25, 2010, 07:30:16 pm
Here is the file "CodeBlocks_rev6527_portable.zip" -link removed-  
I have set:
1. Settings -> Environment -> Help files : add the path to file codeblocks.chm (for open it with F1)
2. ->Settings
-->Compiler and debugger
--->Toolchain executables
---->Compiler's installation directory
     (manual search the path of MinGW directory)  
3. when You move the directory to a USB key You need manual re-set the path for the Compiler - debugger
4. I have not tried the plugins

Title: Re: Portable Code::Blocks
Post by: rbon on August 27, 2010, 08:43:53 pm
Hi,
here is a mini How-to to create a portable version of CodeBlocks
1. install "codeblocks-10.05mingw-setup.exe"
2. create a folder on desktop with name "CodeBlocks"
3. download the last Nightly build
4. download CbLauncher ver 0.1.3
5. create in desktop CodeBlocks a sub-folder "tool"
6. unzip the files of the Nightly build in desktop CodeBlocks
7. unzip CbLauncher in desktop CodeBlocks
8. copy from installed version to desktop the folder "MinGW" in "tool" and the folder "docs" in the same path in the desktop folder
9. copy the desktop folder in a USB key
10. run CbLauncher: this launcher create a folder AppData
11. go to Setting and set the name and the folder of Help file (codeblocks.chm) and check for open it with F1
12. go to Settings and set the path of the folder MinGW (inside "tool")
13. finally uninstall "codeblocks-10.05mingw-setup.exe"
14. if You like a localization, create a folder "locale" in \CodeBlocks\share\CodeBlocks\de_DE or fr_FR and copy in this sub-sub-folder the appropriate file "_codeblocks.mo".
15. if You move this folder from USB to Hard Disk or and external HD, delete "AppData", launch CbLauncher again and set, in Settings, the nome and path of help file and the path of MinGW.

btw
I have checked the Windows Registry with Regshot 1.8.2 before and after run the portable version: this build write various key in
HKU\...\Software\Classes\CodeBlocks.* (various files extension) or
HKU\..._Classes\CodeBlocks.* (various files extensions).
Title: Re: Portable Code::Blocks
Post by: MortenMacFly on August 28, 2010, 09:23:16 pm
I have checked the Windows Registry with Regshot 1.8.2 before and after run the portable version: this build write various key in
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.
Title: Re: Portable Code::Blocks
Post by: rbon on August 30, 2010, 09:06:06 am
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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on September 16, 2010, 01:59:14 pm
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. :)
A reminder.
Hi, biplab, did you forget to add your cblauncher code to trunk?
I have used it for about one year.  :D
Title: Re: Portable Code::Blocks
Post by: xors3d on October 04, 2010, 10:39:13 pm
can anybody upload a final portable code::blocks inclusive mingw?
i tried to make portable myself but nothing result correctly...
sorry for mybad english....but i need the portable actually version tomorrow if any could help me
Title: Re: Portable Code::Blocks
Post by: codeur on November 29, 2010, 11:21:53 pm
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/
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 01:41:31 am
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/

thanks!!!
Nice, can some developers add this to the trunk?
BTW: I have asked biplab several times in the past year, but he was too busy and have no time to do this.
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 01:43:37 am
btw: I hate the download site, I need to wait 11 min to start the download :shock:
Edit
I just enter the Captcha again and again, but every time I need to wait. this is a endless loop....... :evil:
I give up!!
can some body just download it and share it to another site? thanks
Title: Re: Portable Code::Blocks
Post by: codeur on November 30, 2010, 02:39:11 am
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
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 02:42:20 am
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
thanks, this site works fine!!!
Title: Re: Portable Code::Blocks
Post by: Biplab on November 30, 2010, 11:24:25 am
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/


Thanks codeur for the update.

Unfortunately my regular job keeps me quite busy and that is the reason I find little time to update my blog.

I would like to include this in our repo. I checked previous version of your launcher and I found that your name & email id was not included in the source files. Please include them in and pm me a link to updated source files. :)
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 02:05:07 pm
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)
the icon of the cblauncher is not as good as the codeblocks.exe.
Title: Re: Portable Code::Blocks
Post by: xunxun on November 30, 2010, 02:40:19 pm
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)
the icon of the cblauncher is not as good as the codeblocks.exe.
I think "icons\codeblocks.ico" should be replaced by the C::B's.
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 02:50:29 pm
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)
the icon of the cblauncher is not as good as the codeblocks.exe.
I think "icons\codeblocks.ico" should be replaced by the C::B's.
where is C::B's icon.
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/src/resources/icons/app.ico
this one?
Title: Re: Portable Code::Blocks
Post by: xunxun on November 30, 2010, 03:04:45 pm
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2010-11-30205253.png)
the icon of the cblauncher is not as good as the codeblocks.exe.
I think "icons\codeblocks.ico" should be replaced by the C::B's.
where is C::B's icon.
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/src/resources/icons/app.ico
this one?
I think so.
Title: Re: Portable Code::Blocks
Post by: ollydbg on November 30, 2010, 03:08:47 pm
I think so.
agreed.
I have just build against this icon, and it is quite good.
BTW: my anti-virus soft ware just reported the new build cblauncher.exe is Trojan. ....stupid of my anti-viurs. (360safe).
Title: Re: Portable Code::Blocks
Post by: Biplab on November 30, 2010, 04:33:00 pm
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. :)
A reminder.
Hi, biplab, did you forget to add your cblauncher code to trunk?
I have used it for about one year.  :D

Well I didn't forget completely. I was working on it in my free time. But 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.
Title: Re: Portable Code::Blocks
Post by: codeur on November 30, 2010, 10:42:03 pm
... 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.

Biplab, I suggest waiting to commit to ../src/tools until we get some feedback on 0.1.4 (or the lack of feedback convinces us that it is working OK for users), then do changes like the icon change suggested by ollydbg, or adding my coding name to the authors as you suggested (I think it is there in the 0.1.4 documentation, it is JLK), renumber the version to 1.0 and commit to trunk. There is no hurry.

Do you remember what commits you saw that made CB portable without any launcher? I have not seen that.

AFAIK Codeblocks can be started portably by a simple batch file. Even changing the path to carry development tools as part of the IDE can be done in some primitive way in the batch file. The only thing that cannot be done by a batch file (I think) is adding a programmer's font to the system, but most programmers can live with that and tolerate using Courier New when they move to different systems.

In my case I continued developing the portable launcher because as a programming teacher I distribute CB to hundreds of students and get it installed on university computer labs. It has to work portably "out of the box", with all development tools installed and working portably, and with a good, common programmer's font. Loaden's portableCB ( http://code.google.com/p/portablecb/ ) has these facilities inbuilt, but it is not supported by CB developpers.
In addition I cannot afford to struggle with batch files on a variety of systems.
Title: Re: Portable Code::Blocks
Post by: ollydbg on December 01, 2010, 01:36:30 am
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:
http://code.google.com/p/portablecb/
maybe this one:
portablecb.patch (http://portablecb.googlecode.com/files/portablecb.patch)
Title: Re: Portable Code::Blocks
Post by: xunxun on December 01, 2010, 04:15:27 am
I guess it is loaden's patch to make codeblocks.exe portable. The patch can be downloaded from loaden's site:
http://code.google.com/p/portablecb/
maybe this one:
portablecb.patch (http://portablecb.googlecode.com/files/portablecb.patch)
The patch works well if you don't need codesnippets or cb_share_config.
Title: Re: Portable Code::Blocks
Post by: ollydbg on December 18, 2010, 03:16:40 pm
@codeur (http://forums.codeblocks.org/index.php?action=profile;u=4689)
I have two question:

1, it seems in the source code of "launcher.cpp", you just add some extra tools path to the system environment "PATH" variable, does this system variable will be changed when the cblauncher exit? (the PATH variable is modified temporarily or permanently?)

2, in the source code, you use a variable "nuPath", I suggest change its name to "newPath".

thanks.

 :D :D
Title: Re: Portable Code::Blocks
Post by: codeur on December 18, 2010, 11:04:54 pm
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.

2- You're a funny guy.
Variable names are really a matter of personal preference or habit as long as the names are not misleading.
However with respect to poor English speakers you may have a point. It is probably better to respect strict English spelling in identifier names provided that they don't get too long, otherwise these programmers may end up writing English text with the same strange spelling we use in coding. (BTW: I am French)
I'll change that variable name in the next version.
 
Title: Re: Portable Code::Blocks
Post by: ollydbg on December 19, 2010, 03:32:28 am
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.

thanks for your reply. I found a more detailed article. here:
http://vlaurie.com/computers2/Articles/environment.htm
it said:
Quote
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.

Quote
I'll change that variable name in the next version.
nice to hear.


 
Title: Re: Portable Code::Blocks
Post by: codeur on December 19, 2010, 04:38:19 am
it said:
Quote
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.

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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on December 19, 2010, 08:53:23 am
it said:
Quote
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.

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.

Ok, thanks for the explanation.
Title: Re: Portable Code::Blocks
Post by: codeur on January 03, 2011, 12:05:33 pm
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)
Title: Re: Portable Code::Blocks
Post by: ollydbg on January 04, 2011, 01:32:18 am
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)


very nice job, thank you!!!!
Title: Re: Portable Code::Blocks
Post by: ollydbg on January 18, 2011, 02:47:14 pm
Hi, all
since the batch script here
http://forums.codeblocks.org/index.php/topic,10360.msg71730.html#msg71730

is it possible use a better way
Code: [Select]
:: 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

which means, the curpath is better than the HOMEDRIVE

I just copied from:
http://blogs.msdn.com/b/oldnewthing/archive/2005/01/28/362565.aspx

any ideas?

thanks.

Title: Re: Portable Code::Blocks
Post by: codeur on February 18, 2011, 12:52:33 pm
A new version of the portable launcher is available:
http://CbLauncher.codecutter.org/CbLauncher_0.1.6.zip

 *  v-0.1.6 February 2011
 *  - Fixed: "PATH" environment variable was incorrectly set when long.
 *  - Changed all code to pure unicode strings (no TCHAR and no _T(..))
 *  - Removed --debug-log from Code::Blocks call (not useful as launcher now passes
 *    command line parameters).
 *
Please post any issue you may encounter with the portable CbLauncher in this thread.
Title: Re: Portable Code::Blocks
Post by: ollydbg on February 18, 2011, 01:06:03 pm
I can't download this package... the link is broken??
Title: Re: Portable Code::Blocks
Post by: Baluarte on February 18, 2011, 01:21:43 pm
I can't download this package... the link is broken??

True!

Title: Re: Portable Code::Blocks
Post by: codeur on February 18, 2011, 01:38:01 pm
I can't download this package... the link is broken??

It's there now. I had to implement a "last minute" change.
Title: Re: Portable Code::Blocks
Post by: ollydbg on February 18, 2011, 01:41:31 pm
I can't download this package... the link is broken??

It's there now. I had to implement a "last minute" change.
ok now, thanks!!!
Title: Re: Portable Code::Blocks
Post by: codeur on March 12, 2011, 03:02:14 am
The latest version of the portable CB launcher is out:
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.
Title: Re: Portable Code::Blocks
Post by: rbon on March 14, 2011, 09:01:03 am
Quote
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.
Hi,
I have tried to download the archive "Codeblocks-EP.zip" - Version 1.1.1 from http://codeblocks.codecutter.org , but the download dont't work: appears the message "404 Not Found".
Do You can add this file to download?
Thanks

Title: Re: Portable Code::Blocks
Post by: codeur on March 14, 2011, 09:34:13 am
Thanks for mentioning this rbon. The bad link is fixed now.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2011, 07:18:48 am
The latest version of the portable CB launcher is out:
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?

Codeblocks has a build-in mechanism to detect multi-instances. which is: menu->settings->environments->allow only one instance.

I always check this off, because I want to run several c::b instances. Any ideas?thanks.
Title: Re: Portable Code::Blocks
Post by: codeur on April 16, 2011, 07:31:19 am
@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?
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2011, 09:53:21 am
@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?
I just do a flesh install (unzip the nightly build 7075 and cb portable launcher 1.0).

1, When first run the cb launcher, I uncheck both the "allow only one running instance" and "use an already running instance".Then I close the cb.
2, I run the cb launcher again. then I try to run another instance of cb launcher, but nothing happened. so, I guess the second c::b does not start correctly or  was abort.

If I use an old version of portable launcher, e.g. CbLauncher_0.1.5.zip (http://cblauncher.codecutter.net/CbLauncher_0.1.5.zip), then I can start two instances of c::b.

So, I think there are some bugs in this version: CbLauncher_1.0.zip (http://cblauncher.codecutter.org/CbLauncher_1.0.zip)

Can someone test it?
thanks.

Title: Re: Portable Code::Blocks
Post by: codeur on April 16, 2011, 10:25:38 am
Thanks for the report ollydbg.
I have tested and can confirm the bug. I am looking into it.
Title: Re: Portable Code::Blocks
Post by: codeur on April 16, 2011, 11:29:44 am
@ollydbg
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.
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 16, 2011, 02:06:09 pm
@ollydbg
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.
Ok, tested and it works fine! thanks!!!.
Title: Re: Portable Code::Blocks
Post by: codeur on April 17, 2011, 03:59:17 am
Release  v1.0.1 of CbLauncher (complete with source and docs) now available for download at http://cblauncher.codecutter.org/CbLauncher_1.0.1.zip
- Fixes bug with multiple instances of CB reported by ollydbg.

Biplab or other developer, please commit to contrib when you have time.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 17, 2011, 11:32:31 am
Biplab or other developer, please commit to contrib when you have time.

Hi,

Please post another tarball with your Name, email id to assign copyrights. Basically I want to change the following lines from -
Quote
Copyright (C) 2009-2011 Biplab Kumar Modak
to-
Quote
Copyright (C) 2009-2011 codeur (codeur@codeur.com)
Copyright (C) 2009 Biplab Kumar Modak

I'll obfuscate your email id before committing.

I'll commit it to trunk over the next weekend. Thanks for your good work!
Title: Re: Portable Code::Blocks
Post by: MortenMacFly on April 17, 2011, 11:44:05 am
I'll commit it to trunk over the next weekend.
I guess it would fit best under src\tools\CBLauncher (or cb_launcher...).
Title: Re: Portable Code::Blocks
Post by: Biplab on April 17, 2011, 11:47:10 am
I'll commit it to trunk over the next weekend.
I guess it would fit best under src\tools\CBLauncher (or cb_launcher...).

Yes! You are right. It should go inside tools folder.
Title: Re: Portable Code::Blocks
Post by: codeur on April 17, 2011, 03:21:16 pm
@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.
Title: Re: Portable Code::Blocks
Post by: Biplab on April 24, 2011, 04:35:58 pm
@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. :)
Title: Re: Portable Code::Blocks
Post by: ollydbg on April 25, 2011, 02:38:51 am
@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. :)
nice, waiting this for about one year more.... :wink:
Title: Re: Portable Code::Blocks
Post by: codeur on April 25, 2011, 10:31:13 am
Thanks Biplab. A few updates are likely, but the launcher is currently used a lot around here under several Windows versions, so I am confident patches won't be needed as frequently as if we had committed earlier.