Page 2 of 2

Re: File sharing under iOS

Posted: Fri Sep 23, 2016 8:16 pm
by VertPingouin
Sorry for the mess in my post ! I'll try to clarify this a bit :

1.
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?
Yes it is. But there must be something I miss here. After making the appdata folder point to the document folder, how do I access it from my love project ? For now, I'm looking for xml files within my love folder so with an relative path, something like this :

Code: Select all

    local xd = xml:new("levels/"..name..".xml")
What does my file path become then ?

2.

Code: Select all

no, you shouldn't (need to) hardcode the ID et cetera.
I know, especially because I can't know the id before the app is installed but how do I get the documents path by code ?

Re: File sharing under iOS

Posted: Sun Sep 25, 2016 6:06 am
by VertPingouin
Yes it is. But there must be something I miss here. After making the appdata folder point to the document folder, how do I access it from my love project ? For now, I'm looking for xml files within my love folder so with an relative path, something like
Yes, I was just missing love.filesystem.getAppdataDirectory(), that was pretty obvious !
About the document folder, I just did this in my love project :

Code: Select all

local d = love.filesystem.getAppdataDirectory()
documents = '/var/mobile/Containers/Data/Application/'..split(d,'/')[5]..'/Documents/'
for i,f in ipairs(love.filesystem.getDirectoryItems(documents)) do
  print(f)
end
So I got a document path like this :
/var/mobile/Containers/Data/Application/74B84D21-DB70-4DF0-BCFA-30E19A0DED56/Documents/
but, there is no item in it. A lovE.filesystem.isDirectory returns False, and I failed to read any of my xml put in itunes.

So there is two possibility :
- either my document path is not good at all and, in this case I'm missing an answer to my question 2 from my previous post
- either the folder is not accessible at all from love code and the topic end here...

Re: File sharing under iOS

Posted: Sun Sep 25, 2016 2:05 pm
by s-ol
VertPingouin wrote:
Yes it is. But there must be something I miss here. After making the appdata folder point to the document folder, how do I access it from my love project ? For now, I'm looking for xml files within my love folder so with an relative path, something like
Yes, I was just missing love.filesystem.getAppdataDirectory(), that was pretty obvious !
About the document folder, I just did this in my love project :

Code: Select all

local d = love.filesystem.getAppdataDirectory()
documents = '/var/mobile/Containers/Data/Application/'..split(d,'/')[5]..'/Documents/'
for i,f in ipairs(love.filesystem.getDirectoryItems(documents)) do
  print(f)
end
So I got a document path like this :
/var/mobile/Containers/Data/Application/74B84D21-DB70-4DF0-BCFA-30E19A0DED56/Documents/
but, there is no item in it. A lovE.filesystem.isDirectory returns False, and I failed to read any of my xml put in itunes.

So there is two possibility :
- either my document path is not good at all and, in this case I'm missing an answer to my question 2 from my previous post
- either the folder is not accessible at all from love code and the topic end here...
no, no, no, no. love.filesystem.isDirectory etc are all relative to the Appdata directory already! Usually, on unix they go into °/home/USER/.love/IDENTITY/". You should change the love code so that the default path is "/var/mobile/Containers/Data/Application/74B84D21-DB70-4DF0-BCFA-30E19A0DED56/Documents/". Then "love.filesystem.getDirectoryItems(".")" will show all the files and you can use lf.read, lf.write etc. to access all the data.

Re: File sharing under iOS

Posted: Sun Sep 25, 2016 7:54 pm
by VertPingouin
At last !
I just replaced this
by

Code: Select all

appdata = normalize(Filesystem::getUserDirectory() + "/Documents/");
And change commented save_identity
here so I don't have to put file in appname folder.

I put my xml in itunes then I just have to get them in root directory !

@s-ol : thank you so much for your patience ! I could have understood this quicker if only I read the love.filesystem wiki carefuly...
Thank you a thousand times !