io.lines

I’m trying to load a dictionary and print each line but it is giving me an error:

argument #1 to ‘lines’ (d.txt: No such file or directory)

here is the code, and d.txt is in the folder with main.lua

for line in io.lines(“d.txt”) do
print(line)
end

I have also tried:

local path = system.pathForFile( “d.txt”, system.DocumentsDirectory )

for line in io.lines(path) do
print(line)
end

This doesn’t find d.txt either. Is this a bug? [import]uid: 3018 topic_id: 1186 reply_id: 301186[/import]

system.DocumentsDirectory points to the user folder unde Documents directory (for example c:\users\alex\My Documents…

You have to use system.ResourceDirectory, which points to your app folder. [import]uid: 4883 topic_id: 1186 reply_id: 3186[/import]

Thanks, that worked - I expected it to default to that path as it does when loading an image. [import]uid: 3018 topic_id: 1186 reply_id: 3196[/import]