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?
for the script. The problem is that the File object sometimes thinks file is empty (length property is 0), and other times it is able to re
I don't know of any such problem. Are you checking the return value of File.open()? Is it possible that it's returning false sometimes and that' the length would be 0? If you could post a small example script which
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.
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?
Are you opening the file with shared read-only? also, are you closing yo handle to the file when done, or otherwise encapsulating the file access a separate method/function, so the variable falls out of scope?
Sysop: | Chris Crash |
---|---|
Location: | Huntington Beach, CA. |
Users: | 579 |
Nodes: | 8 (0 / 8) |
Uptime: | 00:34:09 |
Calls: | 10,740 |
Files: | 5 |
Messages: | 444,492 |