how can i count the number of folders present in system.DocumentsDirectory. Actually i’m adding in-app purchase in my app. I am making shows in system.DocumentsDirectory. i want to limit the user to make only 5 shows and after that he/she has to buy my premium version. how can i count the number of shows. plz help.
Thanks [import]uid: 209696 topic_id: 37137 reply_id: 67137[/import]
Hi there,
I think you could use the Lua File System (http://keplerproject.github.com/luafilesystem/manual.html#reference) to accomplish this. Specifically, lfs.dir looks like it would enable you to count the number of entries in a directory.
Alternatively, you could have your code maintain of the number of shows that a person has made (starts at zero, every time they make a show it adds 1, every time they delete a show it subtracts 1, etc.), and you could then store that count in a file (so that it persists even when the app is closed).
Hope this helps.
- Andrew [import]uid: 109711 topic_id: 37137 reply_id: 145398[/import]
i tried both the methods… they both are working. i found second one better and easier,
Thanks
[import]uid: 209696 topic_id: 37137 reply_id: 145764[/import]
Hi there,
I think you could use the Lua File System (http://keplerproject.github.com/luafilesystem/manual.html#reference) to accomplish this. Specifically, lfs.dir looks like it would enable you to count the number of entries in a directory.
Alternatively, you could have your code maintain of the number of shows that a person has made (starts at zero, every time they make a show it adds 1, every time they delete a show it subtracts 1, etc.), and you could then store that count in a file (so that it persists even when the app is closed).
Hope this helps.
- Andrew [import]uid: 109711 topic_id: 37137 reply_id: 145398[/import]
i tried both the methods… they both are working. i found second one better and easier,
Thanks
[import]uid: 209696 topic_id: 37137 reply_id: 145764[/import]