Issues with readString

  1. 2 years ago

    cjp160

    12 Nov 2018 User since 2018

    I'm trying to read from a file in Assets using FileManager and am getting really odd behavior. Sometimes the file will be read correctly, sometimes the file will be read with random text appended to it like the word "screenshot", but most times it just returns null. I've checked the file system on my computer and confirmed that the file exists with the right data. I've also tested this through CreoPlayer with the same issues.

    This is how I create the file:
    Console.write('CreateRoom returns \(value)');
    FileManager1.delete("roomID");
    FileManager1.createFile("roomID", value['roomID']);

    This is how I read the file:
    var path = FileManager1.path("roomID");
    var f = File.open(path, FileMode.Read);
    var s = f.readString();
    Console.write("Luxo Client roomID is \(s)");
    f.close();

    This also only happens with some files and not others. I use this exact same code to access other files without a problem. Is this a known issue or I am doing something wrong?

  2. cjp160

    12 Nov 2018 User since 2018

    I can fix the issue by replacing readString() with readStringOfLength(16) but this only works since I know the length of the string ahead of time. It still breaks for more dynamic strings.

  3. marco

    13 Nov 2018 Administrator User since 2016

    I would read the file in a different way:

    var s = FileManager1.readString("roomID");
  4. cjp160

    26 Nov 2018 User since 2018

    @marco this is still a problem for me. I've tried using your method var s = FileManager1.readString("roomID"); but every once in a while I get random characters appended to the string stored in Documents. This is a big problem because I can't persist user data like their email and password to use when they open the app in the future.

  5. marco

    26 Nov 2018 Administrator User since 2016

    @cjp160 can you please send me a way to reproduce it?

  6. cjp160

    26 Nov 2018 User since 2018

    @marco attached is a project that will read a string from a file every 0.5s and set a label to it's value (which is "testing123"). You should see that every once in a while, the label text gets appended with a random character.

  7. marco

    26 Nov 2018 Administrator User since 2016

    @cjp160 please try this unofficial build https://media.creolabs.com/beta/unofficial/creo_build15548.zip

  8. cjp160

    30 Nov 2018 User since 2018

    @marco this seems to be a lot better, thank you! When will this be included in the official build?

  9. marco

    1 Dec 2018 Administrator User since 2016

    @cjp160 probably next week with the build issues fixed too.

  10. cjp160

    10 Dec 2018 User since 2018

    @marco do you have timing for fixing the build issues?

  11. marco

    10 Dec 2018 Administrator User since 2016

    @cjp160 yes everything has been fixed and we should be able to release a new version in a couple of days.

  12. cjp160

    10 Dec 2018 User since 2018

    @marco great thank you!

or Sign Up to reply!