Author Topic: cmd arg to change default config directory  (Read 1600 times)

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 472
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
cmd arg to change default config directory
« on: 4 January 2016, 01:54:07 »
How can I change the default config directory from the command line when I start megaglest? For testing, I'd like to specify something other than ~/.megaglest

I searched the wiki and forum, and looked at the --help options but didn't see the answer.

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: cmd arg to change default config directory
« Reply #1 on: 4 January 2016, 19:25:19 »
Code: [Select]
$ ./megaglest --help | grep '^--[^ ]*path'
--data-path=x            Sets the game data path to x
--ini-path=x            Sets the game ini path to x
--log-path=x            Sets the game logs path to x
--font-path=x            Sets the game fonts path to x
--show-path-crc=x=y

You probably want to change the ini path, maybe log path, too.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 472
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
Re: cmd arg to change default config directory
« Reply #2 on: 5 January 2016, 22:44:50 »
Thanks for the reply, Tom, but that data dir is not the same as the userData dir.

Quote
#2 An error occurred and MegaGlest will close.
Error msg = [Regular and User data paths cannot have the same value [../../../../.megaglest-git/]

But perhaps the first question I should have asked: Can I use the same user data dir (~/.megaglest) for 3.11.1 as I do for the development version?

I could hard-code the user data dir into the source code, if I knew which source file to edit. I looked through several yesterday but couldn't find it.

Cheers!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: cmd arg to change default config directory
« Reply #3 on: 8 January 2016, 05:48:25 »
Hmm, I wonder why these paths can't be the same. Nothing obvious comes to mind. Given that softcoder implemented this change, he can probably explain that. These paths probably need to be better explained. The wiki is very tautological.  "--data-path=x sets the game data path to x." Very helpful. I've managed to forget the difference, myself, and can't be bothered doing anything more than a git blame  :P.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: cmd arg to change default config directory
« Reply #4 on: 8 January 2016, 15:54:07 »
...Can I use the same user data dir (~/.megaglest) for 3.11.1 as I do for the development version?...
Yes but (better) don't try launch different versions at once, with alternate launching there shouldn't be any problems.

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 472
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
Re: cmd arg to change default config directory
« Reply #5 on: 8 January 2016, 19:27:22 »
Thank you, filux

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: cmd arg to change default config directory
« Reply #6 on: 8 January 2016, 19:51:44 »
So here's my take on this:

--ini-path should point to a directory where the game will look for configuration files of the system / global scope. This is glest.ini, glestkeys.ini etc.

glest.ini defines where to look for configuration files of the user / local scope, as configured in UserData_Root.

As such, you can do the following to run one installation with multiple configurations:

Instance 1:
Run megaglest with --ini-path=$HOME/megaglest-1-system
In $HOME/megaglest-ini-1 you store a modified copy of glest.ini, with UserData_Root=$HOME/megaglest-1-user
You also store copies of the other .ini files whose file name do not contain "user" in this directory.
In $HOME/megaglest-1-user you store glestuser.ini - configured to match your needs for this instance.
You (optionally) also store copies of the other .ini files whose file name does contain "user" in this directory.

Instance 2:
Run megaglest with --ini-path=$HOME/megaglest-2-system
In $HOME/megaglest-ini-2 you store a modified copy of glest.ini, with UserData_Root=$HOME/megaglest-2-user
You also store copies of the other .ini files whose file name do not contain "user" in this directory.
In $HOME/megaglest-2-user you store glestuser.ini - configured to match your needs for this instance.
You (optionally) also store copies of the other .ini files whose file name does contain "user" in this directory.

...
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 472
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
Re: cmd arg to change default config directory
« Reply #7 on: 9 January 2016, 20:47:18 »
Thanks for the HOWTO, Tom.

Apparently $HOME couldn't be used after --ini-path because the path following that argument must be a relative path, not an absolute path.

I reference this thread:
ini-path argument using relative path

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: cmd arg to change default config directory
« Reply #8 on: 12 January 2016, 23:53:57 »
Hmm right that's not so great. But I guess it can be made to work.

Sorry for suggesting that you could use absolute paths there, I forgot this would not work.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

andy_5995

  • Moderator
  • Ornithopter
  • ********
  • Posts: 472
  • Debian Linux user
    • View Profile
    • Andy Alt's home page
Re: cmd arg to change default config directory
« Reply #9 on: 16 January 2016, 20:05:44 »
Here's a cmd argument that will change the location of $HOME/.megaglest

HOME=/home/andy/.config ./start_megaglest

By temporarily changing the location of HOME, the userDataPath (config dir) will be in /home/andy/.config/.megaglest


 

anything