Author Topic: Portability  (Read 13846 times)

guigz

  • Guest
Portability
« on: May 03, 2006, 04:42:25 am »
Is there a way to ask codeblock to write all his config settings in a file in win32 and not in the registry?

I'd like to have a portable IDE to put it on an USB key to develop with the same environment on any PC I'll be on...

Thanks

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Portability
« Reply #1 on: May 03, 2006, 05:31:52 am »
The good thing is Code::Blocks is not using the registry anymore (this change was made a long time ago), even though I have my doubts the place for this file can be changed without modifying the source code. This could then sound like a feature request, and should be easy to implement.

The file is named default.conf. If you want to know where it's saved try searching in the forums (it has been said many times for the different platforms).

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Portability
« Reply #2 on: May 03, 2006, 09:08:46 am »
Is there a way to ask codeblock to write all his config settings in a file in win32 and not in the registry?
You're obviously using the RC2 version (or else you would not be asking). Sorry, but the answer is no. Although RC2 has a plugin to export settings, it never worked.
In fact, it is even worse than that. You will lose your settings when switching to a newer version. However, the good news is that it is worth it.

The current version of Code::Blocks saves its settings to an XML file which has the same name as your current profile (by default, that is "default", but you can launch Code::Blocks with --profile=anyname).

The file is always saved in the "correct" place depending on the operating system. For Linux/Unix, that is ~/.codeblocks, and for Windows, that is the location of the application data shell variable (in a "normal" setting, if there is such thing, something like C:\Documents and Settings\YourName\Application Data. Some older Windows version bury app data somewhere deep inside the Windows folder, and the user can also configure it to be in an arbitrary place).

Contrarily, the application loads its settings from a diversity of places. If it can find settings in the application data folder, it will use these, but if there are none, it will for example also search in the folder where the application is installed.
This was done so you can copy the application as well as your preferred settings onto a removable (possibly read-only) disk together with custom settings that you wish to use.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

guigz

  • Guest
Re: Portability
« Reply #3 on: May 03, 2006, 09:46:19 am »
I use the RC2..

Code::Blocks creates entries in my registry (HKEY_CURRENT_USER\Software)/
It also create a directory in my userprofile dir.

What I want is something more simple:1 config file in the same directory of the Code::Block exe.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Portability
« Reply #4 on: May 03, 2006, 09:50:53 am »
What I want is something more simple:1 config file in the same directory of the Code::Block exe.
This is already implemented in current SVN head. C::B supports (a) config file(s) in the user profile (application data) folder and a config file in the path of C::B. I suggest you update to one of the nightlies and you're done. ;-)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Portability
« Reply #5 on: May 03, 2006, 10:06:27 am »
I use the RC2..

Code::Blocks creates entries in my registry (HKEY_CURRENT_USER\Software)/
It also create a directory in my userprofile dir.

What I want is something more simple:1 config file in the same directory of the Code::Block exe.


what you want is not robust and user friendly, let me explain :
1) config files should (this config file is also some sort of profile : eg : I have added some more compilers) not be put real close to the program. Say you want to upgrade and you first uninstall, say it's a bad (un)installer (there exist plenty of those!!!) and it removes everything in the folder of the application --> bye bye your prescious config file
2) say you have your M$ profiles on another harddisk then windows (advice advice advice, just do that), when winBLOWS it can't take down your profile, and you can copy from it after fresh windows install (after the blow, probably your apps are gone to ;-) )
3) multi-users, say there are different users on your machine, maybe I don't like your settings, and I want things to look a bit different, or maybe you don't like the compilers I added. Every user should have his/her own settings. So where do you put such stuff then : in the home directory (linux) or M$ profile (windows)
guess where the default.conf is now ;-)

as Thomas explained you can do what you want, use the startup parameter, and create an shortcut that always starts up with your profile as the extra param towards CB

But I guess the majority of users will prefer things that provide/solve the above 3 issues

kind regards,
Lieven
« Last Edit: May 03, 2006, 10:20:39 am by killerbot »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Portability
« Reply #6 on: May 03, 2006, 10:32:57 am »
Maybe I did not explain myself thoroughly enough.

You can copy your config file to the executable's folder. It is just not the default location.

Code::Blocks will always use a configuration file that it finds in your user profile directory. However, it will also accept a configuration file that is inside the executable folder, if none is found elsewhere.

Quote
Code::Blocks creates entries in my registry (HKEY_CURRENT_USER\Software)/
It also create a directory in my userprofile dir.
Then you have two versions of Code::Blocks on your machine (or the registry settings are old).
Code::Blocks only does one or the other, not both (RC2 = registry, newer versions = config file).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

guigz

  • Guest
Re: Portability
« Reply #7 on: May 03, 2006, 10:47:35 am »
I do know that this kind of things is not very good for multiuser system,but suppose I take code::block on an usb key and use it on my friend's computers.I'll leave garbages in his registry and user account, and this guy won't be my friend anymore....
With a MonoUser version,I can have My Code::Blocks with my settings on my USB key which can work on his own,without leaving any Garbages on any computer....It's better than MultiUsers since I don't even need a user account....It's easier for me to go on other machines since I do not have to install a whole new CodeBlock and compilers and libraries to be able to work.You'll tell me that it's a waste of space in a multiuser environment, yes it is. But: Code blocks with MingW is 90Mo without wxwidget. An external HardDrive of 40Go is 90euros.You can get a 1Gb USB key for less....I don't care about a multiuser environment. They are good only at work. I just have one account on my laptop.When I go at my friend, he won't create an account for me, he'll just log on his account.It's better for me to have my portable CodeBlocks than a big multiuser-care one which I do not use.If you don't believe it's interesting,just check portableapps.com or www.portablefreeware.com.

Why not add this feature?
Just add a command line  command to tell codeblock to write all his settings in a subdirectory called \settings(for example).That way,to upgrade code blocks,you just have to replace binaries and keep the settings as is...


I use the RC2 version of codeblocks(I downloaded it yesterday)
The directory in my userprofile is an empty one.So it's garbage.
Where can I get newer versions?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Portability
« Reply #8 on: May 03, 2006, 11:17:18 am »
allrighty here we go :

1) RC2 --> uninstall, it is old
2) manually install MingW (or maybe you had it already installed somewhere, then just keep it)
3) download the latest nightly, they are advertised daily in the nightly builds forum (http://forums.codeblocks.org/index.php?board=20.0)
4) reread Thomas's reply, with these newer version you can specify which configuration file to use (--profile=anyname).
Come to think of it, should check ; anyname is profile name or just the conf file name (@Thomas : do you know this by heart ?)

If 4) is a "profile" name then it won't work from the stick since it will look for that profile on your friends computer .... if that profile does not exist -> won't find it, it will fall back to the conf file next to the exe (where you have put your PC's default.conf), so in the end it might work.

Lieven
PS: I also like the "portable" software, so no need to convince me for that ;-)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Portability
« Reply #9 on: May 03, 2006, 12:02:51 pm »
Quote
Come to think of it, should check ; anyname is profile name or just the conf file name (@Thomas : do you know this by heart ?

It's the profile name, not the filename.

@guigz:
Why are you making such a big deal out of this? Please read carefully what's been written here. There is no problem to use it like you want.
Just create an empty file named default.conf on your USB stick and you 're ready to go.
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Portability
« Reply #10 on: May 03, 2006, 12:37:06 pm »
4) reread Thomas's reply, with these newer version you can specify which configuration file to use (--profile=anyname).
Come to think of it, should check ; anyname is profile name or just the conf file name (@Thomas : do you know this by heart ?)
As it happens, I do :)
But he does not need to use the --profile switch, he can just copy the default config file to the app's directory too.
That is, if he ever cares to read the above posts...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Portability
« Reply #11 on: May 03, 2006, 01:53:46 pm »
Code::Blocks will always use a configuration file that it finds in your user profile directory. However, it will also accept a configuration file that is inside the executable folder, if none is found elsewhere.

Well, this gives the impression it first looks in the profile dir, and if nothing there, only then next to the exe. That meanss if you connect your stick into a CB-equipped PC, it will take the PC-config and not the stick one. Or am I seeing ghosts ?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Portability
« Reply #12 on: May 03, 2006, 03:42:04 pm »
Yes, that is exactly what is done. It makes sense, too, think about it.

If there is a config file in the user's profile folder, then obviously, the user will want to use this one.  It is a valid assumption that if you have settings saved in your user profile, then you really want to use these. Nothing else makes sense.

However, if no config file can be found in the user's profile, then Code::Blocks does not know about the user's wishes to start with. This may change after RC3, when we include the divination plugin, but to date, we are utterly clueless about our user's thoughts.

However, if you put the application onto a CDROM or a Flash-Stick, and you pack a config file into the same directory as the application, then it is a reasonable guess that you actually want Code::Blocks to use that configuration rather than factory settings.
Again, we cannot possibly know what is going on inside someone's head, but this is what people would probably want.

Finally, in the case that no configuration can be found in any place (including the executable's directory), Code::Blocks creates the well-known default.conf in the user's profile folder. Obviously, the vast majority of users wants settings to be persistent, and people would be upset if they had to turn off "Tip of the day" every time the application starts ;)

Hint:
I forgot to mention that earlier, sorry: If you really want to be roaming, roaming, roaming, roooooaming, then put your config file onto a webserver and start Code::Blocks with the option
--profile=http://url.to/your.conf. That way, Code::Blocks gets its configuration off the internet, and it starts exactly the same way every time, on every PC.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Guest

  • Guest
Re: Portability
« Reply #13 on: May 03, 2006, 05:07:48 pm »
I'm using the latest nightly on WinXP-SP2. I renamed the codeblocks-folder in my profile and put the conf-file into the app-directory, but it didn't use this file. Instead a new config has been created in my profile. I've also tried using the --profile option with relative and absolute paths without having any success.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Portability
« Reply #14 on: May 03, 2006, 07:46:15 pm »
Yes my bad, fixed that.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."