If we could get the File object in iOS, even only part of it, like just to Delete or Rename files, my brain would hurt a lot less. Is there any chance of that?
Printable View
If we could get the File object in iOS, even only part of it, like just to Delete or Rename files, my brain would hurt a lot less. Is there any chance of that?
Hmmm it might need to be a special object, just thinking I am pretty sure Apple has REAL restrictive guidelines on what an app can do.
What do you want your iOS app to do?
I just need a simple way to do file management on ini files: Delete an ini and rename an ini.
In Cave Diver Tommy when I wanted to reset the stats saved in the apps INI file
I just went thru and save nothing to each items string/value (suppose the delete group/item should work also need to test that)
I think the only think I think you might not be able to accomplish right now is completely removing (deleting) an INI file from inside your app.
Of course you could fool this a little bit by not having real separate INI files and you could use separate groups inside 1 INI file.
But then is your saving a huge amount of material this might not work for you.
We need to have Andos take a look sometime and see what he can get the file object to do in iOS.
I've tried some ways of doing it differently and I even came up with a way using string parser but while that works when I test on the PC, it doesn't work in iOS. I used "Load From File" in String Parser to get all of the data in the INI, then and "Save To File" to save it as as a new name. Worked great on the PC but not in iOS.
My situation is this: I have an INI for each player with the score for each level. It looks like this:
[Player 1]
L1R1=43
L1R2=20
L2R1=18
L1R1 means Level 1, Round 1. That info is in a file called player1.ini. But I want the user to be able to save it as player 2 (etc.) if they want to, so I need to take that player1.ini and rename it to player2.ini. I guess I don't even need the ability to delete, because I can just delete the Group ( [Player 1] ) from the player1.ini and let it get written to by a new person who is playing as Player 1.
So really all I need is the ability to rename an INI file. Or the ability to rename a Group in an INI. Then I could have all of the data save into one INI file with each player in its own Group and, for example, just rename [Player 1] to [Player 3] if the user is playing as Player 1 and then wants to save as Player 3 (I'd first have it delete Player 3 if there's an existing one).
Hopefully that make sense. The short of it is I'd like to be able to either rename an INI or to rename a Group within an INI.
Last week I made an example for you on how to rename an ini group. In case you forgot about it, here is the thread: http://community.clickteam.com/showthread.php?t=72775
Yes, and thanks again. I was even experimenting with it again today. The problem with it is that I haven't been able to figure out a way to copy the list of items (which will be over 100). I'd need a way to say "all items in this group". Is that possible? (By the way, I thought I'd written back to you in that thread after I finally tried it but I guess I didn't. I'm sorry about that.)
Heh, no problem :)
Well, the normal ini object does not have a way to loop through all items in a group, so you would have to find a way to do it. It is definately possible, you just have to code the ini the right way. Is the ini group dynamic? I mean, will you create items at runtime? If the items are hardcoded like: Life, Level, Score etc I see no problems in selecting all items in a group, since you know what the items are named. It will take a some time to hardcode 100 items, but it is certainly doable. But if you create them dynamically, like Unit1, Unit2, Unit3 etc, you would have to run a loop that tests for all the possible itemnames. You would need to store somewhere the number of items in a group so that you know how many times to run the loop.
Hard coding is out of the question. Really the best solution would be to be able to rename Groups within an INI or to be able to rename the INI itself. I think other people would find that useful too. Out of both ideas, I suspect the renaming of Groups would be the easiest to implement since it wouldn't run into any Apple file management issues-- you're just manipulating data within a file. I'd still have to modify my game, but I'd be happy to do that.
Jeff, what about adding to the INI object the ability to rename groups?