Unexpected behavior from file-system readTextSync()? (nativescript)

84 views Asked by At

I think the NS file-system readTextSync method is supposed to be called as follows

    let result = file.readTextSync( function(e)
    {
        console.error( "error " + e );

        throw Error( "Error deleting js_code file!" );

    } );

console.log( "result=" + result );

Firstly it returns a blank string - even if the file doesn't exist.

If I give it an invalid path, then a Java exception is thrown (this is Android) - the error function is not called.

1

There are 1 answers

0
Romulo Pires On

I think that this reply on a github issue can help you:

https://github.com/NativeScript/NativeScript/issues/3248#issuecomment-265251367

Seems to be a problem on how you get a path of your file.