After some assistance from fellow forum members I’ve been able to create text files in Codea on my iPad 2. Next question is, how do I get them to my PC or Dropbox (and get them back again)? I thought there was an app “iExplorer” (by Macroplant) that was supposed to show the iPad’s file system and let you copy/paste files, but I just got it and it’s not at all that, it’s just another file editor with its own desktop and apparently unable to look anywhere else on the iPad at all. Is there an app that does let you examine your iPad, or at least able to read/write Codea’s Documents directory?
On a related note, I saw somewhere someone could read/write a file directly on Dropbox? How is that done? (It won’t work for my current code because there’ll be no internet, so data files have to be saved locally, to be uploaded later.)
or you can use droptext app to copy and past codea source code
@starblue, I use iFunBox as well. It is a very useful tool, but you do need to connect your ipad to a computer.
As for the upload to Dropbox code, I’m not sure if you already found the thread, but here is the one @Ignatz created.
I haven’t gone through the code myself yet to see how it all works as I am using AutoGist for backing up my project, but I suspect you aren’t just looking to backup your project. I assume the code would work for backing up any files, I could be wrong though.
Let’s rephrase what I want from this thread.
There’s a example here showing how to read/write files in Dropbox: http://twolivesleft.com/Codea/Talk/discussion/3031/save-file-directly-on-dropbox#Item_7. I tried it and it works. I infer that the process of connecting up Dropbox using the (LHS slider’s) “Sprite” tool creates a directory called $HOME/Documents/Dropbox.spritepack/ on the iPad2, while the directory Dropbox/Apps/Codea/ is created in Dropbox (and then onto my PC). Files written to these 2 locations can be sync’ed. I can see the files when logged into Dropbox from my PC, when inside Windows 7 “Windows Explorer” tool, and when logged into Dropbox’s app on the iPad2. The only place I can’t see the files is inside the “Sprite” tool: there are 2 tiles, “Photo Library” and “Paste Image”, but no files are shown, even after sync-ing. (A suggestion to the Codea developers: show the full contents of this directory.)
Therefore, my question becomes, is there any point writing text files to any directory other than $HOME/Documents/Dropbox.spritepack/, since no one can ever see them except Codea? And even there, the user can’t see them since there’s no way to list the directory? (Why on earth doesn’t Lua have a “list_directory” library function? And even if Lua won’t, why can’t Codea write a C-extension to add the capability for whatever directories are allowed to contain user-written data?)
You can only see files with a .png extension in the Sprite directory. If you write a file with a .png extension it will show, but will probable give you a problem on the PC.
What’s the full pathname of the “Sprite” directory? Surely it’s not $HOME/Documents/Dropbox.spritepack/ because I wouldn’t have had any sprites until today when I installed Dropbox. I don’t understand Codea’s directory structure and what directories can or cannot be written to.
I don’t think the file/directory structure is like what’s on a PC. That’s what makes it a problem. As for the Sprite directory pathname, I don’t know.
@starblue Apple has a lot of restriction on his OS. Accessing directories from your apps from own ipad is not allowed. This is a real pain in the … However, there is a great solution: jailbreak. Then you can install iFile (free) that give you access to your own ipad as you would on any normal computer.
@starblue – Did you ever find your answer? I’m trying to find similar answers. It seems that the $HOME/Documents/Dropbox.spritepack/ folder doesn’t work for me. I don’t know if this is because the latest version of Codea deprecated access or not…
Cool Forum Update! but one question, how to connect text files to lua main class? No, really, how to connect it?
@DaddyCoder in the latest version of Codea (2.3.2 which came out yesterday) the path to Dropbox is now
However, if you’re planning on eventually exporting your code to Xcode, this path won’t point to the bundled assets.
Generally then, I’d recommend using the
saveText commands. Rather than the above path and the Lua io and file libraries. These were only added to Codea last year, so that’s why they’re not discussed in the above, rather old thread (something to be aware of when searching the forum).
ReadText and saveText only work with certain extensions, there’s a list somewhere on the forum, .txt .json etc.
They work consistently after exporting to Xcode.