Hello everyone,
I wonder if it is possible to use file sharing of itunes to feed my game with xmls (containing custom levels datas).
Currently, file sharing is activated by default in iOS source but I've no idea where I'm putting shared file.
As I can understand here
https://developer.apple.com/library/con ... -CH10-SW30
There is a fixed document folder somewhere but I don't know if love2d can access a folder outside of the .love directory or if there is a way to alter the folder used.
Anyone has any knowledge on this, it would be awesome to be able to do that !
[Resolved] File sharing under iOS
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
[Resolved] File sharing under iOS
Last edited by VertPingouin on Sun Sep 25, 2016 7:54 pm, edited 1 time in total.
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
Re: File sharing under iOS
Anyone ?
Here is where I am now :
File sharing is used to transfer love projects to be able to select them within the app, but the code chunk is never called when my love project is integrated. This is not what I'm looking for, but that's a start.
I'm now sure that I can't access it within my lua code.
I think I should modify something in the xcode project to copy files in document folder to my love folder at some point, but I havn't a clue where to do it. I know vaguely how but not where (or when). Could someone at least tell me where I can get this information ? As far as I can see, i doubt it is simple but I don't want to learn th whole ios app thing just to be able to use file sharing. There must be someone that can help me on this. I just don't know if i'm at the right place to ask.
Here is where I am now :
File sharing is used to transfer love projects to be able to select them within the app, but the code chunk is never called when my love project is integrated. This is not what I'm looking for, but that's a start.
I'm now sure that I can't access it within my lua code.
I think I should modify something in the xcode project to copy files in document folder to my love folder at some point, but I havn't a clue where to do it. I know vaguely how but not where (or when). Could someone at least tell me where I can get this information ? As far as I can see, i doubt it is simple but I don't want to learn th whole ios app thing just to be able to use file sharing. There must be someone that can help me on this. I just don't know if i'm at the right place to ask.
Re: File sharing under iOS
- slime
- Solid Snayke
- Posts: 3159
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: File sharing under iOS
Un-fused LÖVE looks in the Documents directory for .love files, and for folders containing main.lua. You can transfer .love files or folders there via iTunes:
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
Re: File sharing under iOS
I run straight into fusing my game ! It works well unfused of course. But this is not what I'm looking for, thank you though slime, you made my life simpler for now.
@s-ol : when I look at the Filesystem object in debug mode, the appdata string is an empty string. But I've got the game_source full path. That's a beginning. For the ios.mm file, it is never accessed when game is fused but I can get the document folder from here when running it unfused. I saw that I only can access document folder path via builtin functionNSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); in objective C source files, it is done in IOS.mm but this file is never used when running fused game...
So I need to do it elsewhere...
I keep looking but I definitely lack some knowledge... I'm afraid I won't escape this without learning a few things about ios apps...
@s-ol : when I look at the Filesystem object in debug mode, the appdata string is an empty string. But I've got the game_source full path. That's a beginning. For the ios.mm file, it is never accessed when game is fused but I can get the document folder from here when running it unfused. I saw that I only can access document folder path via builtin functionNSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); in objective C source files, it is done in IOS.mm but this file is never used when running fused game...
So I need to do it elsewhere...
I keep looking but I definitely lack some knowledge... I'm afraid I won't escape this without learning a few things about ios apps...
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
Re: File sharing under iOS
Ok, I misplaced my debug breakpoint. Ok, I've got the appdata folder now.
I'm not sure to understand what I should make of it. What is this appdata folder ?
I also have the game source folder where I could copy my xmls... But I still don't see what to do without the document folder.
I'm not sure to understand what I should make of it. What is this appdata folder ?
I also have the game source folder where I could copy my xmls... But I still don't see what to do without the document folder.
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
Re: File sharing under iOS
Anyone ?
Re: File sharing under iOS
Change the love source code so the appdata points somewhere else so the data ends up in /Documents so you can see it in iTunes.VertPingouin wrote:Anyone ?
-
- Prole
- Posts: 9
- Joined: Wed Sep 14, 2016 6:41 am
Re: File sharing under iOS
I understand that. After doing that, my appdata folder is my documents folder. So when I add files from itunes, I can access it by accessing the filesystems appdata string. Ok I get that. I still don't know how to get documents folder on the fly but let's put that aside. Anyway it's something like
/var/mobile/Containers/Data/Application/<some hexadecimal string which I think identifies my app>/Documents/
Ok I just "bruteforcely" set my app data to match my document folder
appdata = "/var/mobile/Containers/Data/Application/037A8D0D-4D5A-4063-8C1A-890B10FEE199/Documents/";
I put some files in it, but what now ? Should I copy them ? And if so I've another issue, I can't use NSFileManager in Filesystem.cpp. Should I include something to do so ?
I'm sorry to ask so specific things and actually be begging for an easy way. You could as well have told me to rtfm but I spent so much time with my game that I am lacking some now
/var/mobile/Containers/Data/Application/<some hexadecimal string which I think identifies my app>/Documents/
Ok I just "bruteforcely" set my app data to match my document folder
appdata = "/var/mobile/Containers/Data/Application/037A8D0D-4D5A-4063-8C1A-890B10FEE199/Documents/";
I put some files in it, but what now ? Should I copy them ? And if so I've another issue, I can't use NSFileManager in Filesystem.cpp. Should I include something to do so ?
I'm sorry to ask so specific things and actually be begging for an easy way. You could as well have told me to rtfm but I spent so much time with my game that I am lacking some now
Re: File sharing under iOS
what?VertPingouin wrote:I understand that. After doing that, my appdata folder is my documents folder. So when I add files from itunes, I can access it by accessing the filesystems appdata string. Ok I get that. I still don't know how to get documents folder on the fly
no, you shouldn't (need to) hardcode the ID et cetera.but let's put that aside. Anyway it's something like
/var/mobile/Containers/Data/Application/<some hexadecimal string which I think identifies my app>/Documents/
Ok I just "bruteforcely" set my app data to match my document folder
appdata = "/var/mobile/Containers/Data/Application/037A8D0D-4D5A-4063-8C1A-890B10FEE199/Documents/";
what? copy which files? copy them from where to where?I put some files in it, but what now ? Should I copy them ?
If you change the path in the 'common' file there will probably not be the need to.And if so I've another issue, I can't use NSFileManager in Filesystem.cpp. Should I include something to do so ?
I'm sorry to ask so specific things and actually be begging for an easy way. You could as well have told me to rtfm but I spent so much time with my game that I am lacking some now
If you can read and write data to the Documents directory, then everything is accomplished, no? What's the problem / what are you triyng to do now?
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests