Hi every one! I’m trying to READ txt file. There is code:
using sys.io.File
cat_text = new TextField ();
cat_textf = new TextFormat( "Arial", 35, 0xff0000);
cat_text.defaultTextFormat = cat_textf;
cat_text.autoSize = LEFT;
cat_text.text = readLine('words/lol.txt', 0);
cat_text.x = 100;
cat_text.y = 100;
addChild(cat_text);
and readLine function
public function readLine(fileName, lineNumber)
{
var fin = sys.io.File.read(fileName, false);
try {
for (i in 0...lineNumber)
fin.readLine();
line = fin.readLine();
fin.close();
}
catch (e:haxe.io.Eof) { return null; }
return line;
}
and it works fine when I’m build it on mac. But it crushes on android with
I/trace (13097): Lib.hx:348: [file_open,words/lol.txt]
I spended 3 days to find a mistake. So I made a conclusion, that readLine
command looking for lol.txt in wrong place!
android permission="android.permission.WRITE_EXTERNAL_STORAGE"/
is there too!
Please help! I really can’t sleep. I rooted my android. And I think I’m so close to solve this issue!