Topic: How to use specific DATA directory?
Hi there.
I would like to start Teeworlds client using a specific DATA directory, preferably using command line parameter. How can I do this?
Thanks in advance
You are not logged in. Please login or register.
Teeworlds Forum → Support → How to use specific DATA directory?
Hi there.
I would like to start Teeworlds client using a specific DATA directory, preferably using command line parameter. How can I do this?
Thanks in advance
Hellu,
look at the file storage.cfg and the directive add_path.
And 'storage.cfg' must be in the same folder as Teeworlds executable, or I can call it from another directory?
And 'storage.cfg' must be in the same folder as Teeworlds executable, or I can call it from another directory?
Run "config_directory.bat" to open the folder that contains storage.cfg.
Thanks Dune but, considering I'm using Linux, this batch files won't help... But it seems to me Teeworlds won't allow me to define "storage.cfg" location via command-line.
Looking at the source code, in src/engine/shared/storage.cpp (which includes the header engine/storage.h), I notice it will search in current dir and, case it fails, will "check usable path in argv[0]".
How can I pass a specific path for storage.cfg in order to storage.cpp make use of the path I want?
See snippet of src/engine/shared/storage.cpp below:
void LoadPaths(const char *pArgv0)
{
// check current directory
IOHANDLE File = io_open("storage.cfg", IOFLAG_READ);
if(!File)
{
// check usable path in argv[0]
unsigned int Pos = ~0U;
for(unsigned i = 0; pArgv0[i]; i++)
if(pArgv0[i] == '/' || pArgv0[i] == '\\')
Pos = i;
if(Pos < MAX_PATH_LENGTH)
{
char aBuffer[MAX_PATH_LENGTH];
str_copy(aBuffer, pArgv0, Pos+1);
str_append(aBuffer, "/storage.cfg", sizeof(aBuffer));
File = io_open(aBuffer, IOFLAG_READ);
}
if(Pos >= MAX_PATH_LENGTH || !File)
{
dbg_msg("storage", "couldn't open storage.cfg");
return;
}
}
char *pLine;
CLineReader LineReader;
LineReader.Init(File);
while((pLine = LineReader.Get()))
{
if(str_length(pLine) > 9 && !str_comp_num(pLine, "add_path ", 9))
AddPath(pLine+9);
}
io_close(File);
if(!m_NumPaths)
dbg_msg("storage", "no paths found in storage.cfg");
}
The quickest work-around that comes to my mind is to create a symbolic link to the teeworlds server in the directory where you want your storage.cfg.
Teeworlds Forum → Support → How to use specific DATA directory?
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.