• File object randomly thinks file is empty

    From Digital Man@VERT to Nightfox on Friday, July 03, 2009 23:39:40
    Re: File object randomly thinks file is empty
    By: Nightfox to All on 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?

    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's why the length would be 0? If you could post a small example script which demonstrates the problem, that would be helpful. I don't think the filename length or directory where the file is located is an issue.

    digital man

    Snapple "Real Fact" #160:
    One alternate title that had been considered for NBC's hit "Friends" was "Insomnia Cafe."

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net