Author Topic: Portable Code::Blocks  (Read 115599 times)

Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #60 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.
« Last Edit: December 01, 2010, 01:27:15 am by codeur »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #61 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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Portable Code::Blocks
« Reply #62 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
The patch works well if you don't need codesnippets or cb_share_config.
Regards,
xunxun

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #63 on: December 18, 2010, 03:16:40 pm »
@codeur
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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #64 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.
 

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #65 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.


 
« Last Edit: December 19, 2010, 08:42:20 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #66 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #67 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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #68 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
Download link 2:
cblauncher.codecutter.net/CbLauncher_0.1.5.zip

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #69 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
Download link 2:
cblauncher.codecutter.net/CbLauncher_0.1.5.zip


very nice job, thank you!!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #70 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.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #71 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.
« Last Edit: February 18, 2011, 01:31:21 pm by codeur »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Portable Code::Blocks
« Reply #72 on: February 18, 2011, 01:06:03 pm »
I can't download this package... the link is broken??
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Portable Code::Blocks
« Reply #73 on: February 18, 2011, 01:21:43 pm »
I can't download this package... the link is broken??

True!


Offline codeur

  • Multiple posting newcomer
  • *
  • Posts: 113
    • Code::Blocks EDU-Portable
Re: Portable Code::Blocks
« Reply #74 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.
« Last Edit: February 18, 2011, 01:39:52 pm by codeur »