View unanswered posts | View active topics It is currently Thu Jan 16, 2025 2:22 pm



Reply to topic  [ 6 posts ] 
 where is the configuration file on linux 
Author Message

Joined: Sat Dec 18, 2010 1:14 am
Posts: 12
Reply with quote
Post where is the configuration file on linux
…an i mean: “where does the game search first for it”

i can run cortex command fine, but in order to open the configuration file, which is in the game folder, i have to start it with admin rights.

if there isn’t one:
if the file in the game folder can’t be written to, the game should read and write in/out a file called /home/<username>/.cortexcommand or /home/<username>/.conf/CortexCommand/Base.rte/Settings.ini or something. this would also allow multiple users on one system allow to play with different settings.


Sat Dec 18, 2010 3:55 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Wed Sep 05, 2007 4:14 am
Posts: 3966
Location: Canadida
Reply with quote
Post Re: where is the configuration file on linux
The configuration file is in the Cortex Command game directory. [Specifically it is the "Settings.ini" in "Base.rte"]
So if you want different settings/configurations for each user, you are going to have to replace/edit it every time you switch to a user with different preferences. [Unless you download/purchase the game for every user.]


Sat Dec 18, 2010 4:23 am
Profile

Joined: Sat Dec 18, 2010 1:14 am
Posts: 12
Reply with quote
Post Re: where is the configuration file on linux
i know where it is, read my first post. putting application data together with configuration files is just not the right way of doing things. there are many reasons against it: multiuser environment, virus protection (a virus without superuser rights can’t corrupt vital files, only the configuration file), system migration (take your home-folder with you and have everything set up equally on each system you’re on), and so on.

are you sure the only way where the game looks for the Settings.ini is inside the game folder? if so, above way of doing it is as simple as 1-2-3:
Code:
pseudocode:

#get folder to store settings into, save into global variable
if system == LINUX:
    override_folder = path.expand("~/.conf/CortexCommand")
else if system == WINDOWS:
    override_folder = path.expand("%APPDATA%\CortexCommand)
else if system == OSX:
     override_folder = path.expand("~/Library/Application Support/CortexCommand")

#call this to access files the game writes to
def write_file(rel_path):
    or_path = path.join(override_folder, rel_path)
    if not path.is_file(or_path):
        #make all dirs up to the file if they don’t exist
        or_dir = path.join(path.split(or_path)[:-1]) #all dirs without file name
        path.makedirs(or_dir)
        #copy file from game directory (which is the working directory) to the override directory
        path.copy(rel_path, or_dir)
    return or_path

#call this to get the full path for every data file you want to access
def read_file(rel_path):
    if path.is_file(path.join(override_folder, rel_path)):
        return path.join(override_folder, rel_path)
    else:
        return path.join(".", rel_path)

that’s it. if the game wants to write a file with path rel_path, it opens the file pointed to (and probably created) by write_file(rel_path), if it wants only read access, it reads the file read_file(rel_path) points to.


Sat Dec 18, 2010 2:29 pm
Profile

Joined: Fri Dec 17, 2010 4:30 pm
Posts: 15
Reply with quote
Post Re: where is the configuration file on linux
i like this one.
im annoyed of the location of the settings.ini too.
games like these wich save their configuration in their own game folders are installed under ~/games/ by me, but that way i need to install these games for every user i have on the system.

because the change in the code would be minimal i would appreciate it that this would find its way in one of the future releases.
its no gamestopper but its just not nice on linux :S


Sat Dec 18, 2010 3:07 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Tue Jul 27, 2004 8:02 pm
Posts: 428
Location: AZ
Reply with quote
Post Re: where is the configuration file on linux
This is a known issue, and we hope to address it in future builds.. settings.ini could be anywhere in the system, the game jsut needs to be smart enough in the linux build to know where to look before defaulting back to /Base.rte/


Tue Dec 21, 2010 6:15 pm
Profile ICQ

Joined: Sat Dec 18, 2010 1:14 am
Posts: 12
Reply with quote
Post Re: where is the configuration file on linux
oh, umm, thx for the answer and sorry for not coming back for so long.

my favourite solution would be simple:
since the game only needs write access to Settings.ini, it copies this file into ~/.CortexCommand/Base.rte at the first start, but every other file is also read preferably from ~/.CortexCommand/… instead of the install dir, so you can e.g. install a mod without overwriting original files.

some devs also prefer ~/.conf/CortexCommand instead of ~/.CortexCommand, but that’s a matter of taste, i think.


Sun Jan 02, 2011 10:17 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.038s | 14 Queries | GZIP : Off ]