Borch
23rd July 2023, 16:16
I am running Ubuntu 22.04 and have been having problems getting a script to open a file. This is an unpatched version of cod2lnxded, is it possible that I don't have libcod installed properly? (I get a statement when I shut down the server that the plugin is unloaded).
At first I could not get file_exists or fileopen to work, but then found that it doesn't seem to work across filesystems, since when I put the target on the same filesystem, file_exists, using path, it started working.
After I figured out the file_exists issue with filesystems, I started getting the proper result when running that, but using the same path, I do not get a file to open successfully using openfile.
output of my logprints:
0:00 path=/home/dev/v3/ohmycod/extreme/spawns/mp_toujane.csv
0:00 exists=1
0:00 filenum=-1
0:00 count=-1 //count is the attempt to read the file
This is the code:
...
path="/home/dev/v3/ohmycod/extreme/spawns/" + level.ex_currentmap + ".csv";
logprint("path=" + path+ "\n");
logprint("exists=" + file_exists(path) + "\n");
if(file_exists(path))
{
filenum = openfile( path , "read" );
logprint("filenum=" + filenum + "\n");
count=FReadLn(filenum); //read first line, should be ok but will be skipped if not.
logprint("count=" + count + "\n");
...
I was able to get openfile to write to a file in the directory .callofduty2/fs_mod/scriptdata folder, in my home directory, without any directories in the path.
I am going to recompile and verify the settings.
Any ideas? Thanks in advance.
At first I could not get file_exists or fileopen to work, but then found that it doesn't seem to work across filesystems, since when I put the target on the same filesystem, file_exists, using path, it started working.
After I figured out the file_exists issue with filesystems, I started getting the proper result when running that, but using the same path, I do not get a file to open successfully using openfile.
output of my logprints:
0:00 path=/home/dev/v3/ohmycod/extreme/spawns/mp_toujane.csv
0:00 exists=1
0:00 filenum=-1
0:00 count=-1 //count is the attempt to read the file
This is the code:
...
path="/home/dev/v3/ohmycod/extreme/spawns/" + level.ex_currentmap + ".csv";
logprint("path=" + path+ "\n");
logprint("exists=" + file_exists(path) + "\n");
if(file_exists(path))
{
filenum = openfile( path , "read" );
logprint("filenum=" + filenum + "\n");
count=FReadLn(filenum); //read first line, should be ok but will be skipped if not.
logprint("count=" + count + "\n");
...
I was able to get openfile to write to a file in the directory .callofduty2/fs_mod/scriptdata folder, in my home directory, without any directories in the path.
I am going to recompile and verify the settings.
Any ideas? Thanks in advance.