Subj : File object randomly thinks file is empty
To : All
From : Nightfox
Date : Fri Jul 03 2009 08:55 pm
Hi all. I'm working on a JavaScript script for Synchronet - a logon matrix -
and I've run into a weird issue with the File class.
In my script, I want to open and read a configuration file that has options
for the script. The problem is that the File object sometimes thinks the
file is empty (length property is 0), and other times it is able to read the
file without any problems. I can observe this just by running the script
several times in a row.
I'm wondering if it might have to do with the fact that I'm placing my script
in a directory other than the SBBS exec directory. I'm using a trick in the
code to determine the script's current directory, and the configuration file
is in a subdirectory that's a couple levels deeper. I've been able to verify
that the File object is indeed able to open the file (or at least thinks it's
open); it just sometimes thinks the file's length is 0, and thus doesn't read
anything from it.
When I create the File object, the filename that will get passed to it is
something along the lines of this:
D:\BBS\sbbs\mods\../xtrn/DigDist\DDLoginMatrixThemes/kd-snake/DDMatrixThe
me.cfg
Is there a known bug related to what I'm describing? Might I simply be
passing too long of a path to the File object?