Saleh
January 16, 2022, 5:04pm
1
I have the following problem:
have a text file in my documents directory (android)
my application should be able to read it
I thought that
`local` `path = system.pathForFile( ` `"myfile.txt"` `, system.DocumentsDirectory )`
would read the file I put in the phone documents directory, but it doesn’t!
Why? How can I read “myfile.txt”?
That’s not the Documents directory of the phone, that’s the app’s documents directory that your app can write to.
Saleh
January 16, 2022, 7:06pm
3
I’ve understood that, but how can I read the phone directory?
proV
January 16, 2022, 7:29pm
4
If you maybe haven’t, Here you can read everything about reading and writing files:
Solar2D Documentation — Developer Guides | Data/Files/Strings (coronalabs.com)
Really Good read!
There’s also Scott’s plugin here - Scott H Tech - but I’ve never used it.
1 Like
Saleh
January 17, 2022, 7:50am
6
@proV I know that. But it doesn’t say anything about the documents directory of the phone!
Saleh
January 17, 2022, 7:51am
7
@GrahamRanson1 thanks, I’ll try it. It’s a pity that Corona SDK doesn’t have a native function!
On the other hand though it’s great that plugin developers can help carry the load so that Vlad and his team can work on larger core improvements.
Saleh
January 17, 2022, 1:23pm
9
@GrahamRanson1 that plugin costs $9.99! I paid and I discovered that it works only on SD card!
Sorry like I said I’ve never used it before so it might be worth contacting Scott about usage/features/support etc
However I don’t think $10 is that steep really. Scott’s had to develop, test, and support the plugin and then attempt to sell it to a small market.
It has to be priced according to the cost to develop ( and support ) divided by by the expected number of purchases.
2 Likes
XeduR
January 17, 2022, 4:18pm
11
Also, and not to blame anyone, but the second paragraph on the page reads:
1 Like
Saleh
January 17, 2022, 6:36pm
12
@GrahamRanson1 I was surprising because it was the first time I had to use a plugin and because Solar2D is free I thought that even the plugin was free. That’s all. Anyone who does something has the right to be paid!
XeduR
January 17, 2022, 7:46pm
14
Saleh:
@XeduR in that page is written that files are in the apk itself. So what’s an external storage? Do you think that everyone is an expert as you are?
Again, I am not casting blame on anyone, but there is no mention of the word “apk” on the page.
There are two storage types: internal and external. External storage refers to removable volumes, like SD cards.
Like you said, there is no need for everyone to be an expert. That is one of the many reasons why plugins exist, so not everyone needs to know how to do these more complex things. However, whenever you are making purchases, you should always know what you are buying. If you aren’t certain about something, then just ask.
1 Like
Saleh
January 18, 2022, 7:48am
15
Wow! You didn’t want to put blame on someone!
My question was:
I have the following problem:
have a text file in my documents directory (android)
my application should be able to read it
I thought that
`local` `path = system.pathForFile( ` `"myfile.txt"` `, system.DocumentsDirectory )`
would read the file I put in the phone documents directory , but it doesn’t!
Why? How can I read “myfile.txt”?
Your premise is just wrong. Operating systems sandbox apps to stop these things specifically to stop malware, etc.
Your application can read it’s own documents folder stored in your apps sandbox/apk.
1 Like
Saleh
January 20, 2022, 2:44pm
17
Saleh
January 20, 2022, 2:58pm
18
@anon63346430 my premise is not wrong! Perhaps it is not possible, but not wrong! Sorry.
Saleh
January 28, 2022, 5:45pm
19
@GrahamRanson1 “Scott’s had to develop, test, and support the plugin”.
The plugin doesn’t work! Because reporting to him that the plugin did work he, who tested etc., modifying the plugin and the documentation but it still doesn’t work!
Hey already replied to your email, but I updated the demo.
You should get the new pop up and you need all access to write and read to phone.