External folders work great. The only problem was trying to figure out how to use them. Still not sure of the exact correct sequence.
Here’s are the steps I used. Don’t know if there’s a shorter way.
Folder doesn’t exist yet.
- Open Codea
- Tap icon upper right for Assets
- Tap Assets
- Tap new folder icon upper right
- Tap Add folder
- Select location from left panel
- Tap new folder icon at top of screen
- Give folder a name
- tap done
- tap open
- folder should show in External list
Folder already exists.
- Open Codea
- Tap icon upper right for Assets
- Select Assets
- tap new folder
- select add folder
- select location
- tap folder
- tap open
- folder shows in external list
That’s correct, you should also be able to add them from the asset picker in the code editor. Sorry it’s a bit laborious, once added though, they should stay there
Is there another place that would make sense to add them? We could update the UI
@ sim I think it’s easy enough the way it is once you do it a couple of times. And like you said, once it’s done it stays there.
I’m thinking it’s just a link to a folder and deleting the link doesn’t delete the folder.
@dave1707 @Sim - hmmmm, interesting.
Worked out how to create a folder, thanks to your descriptions above, and first impressions are good.
Some points though -
- When you get into the folder selection windows everything seems to be greyed out.
- Some times the keyboard didn’t appear when expected, probably as you need to do a double tap on the new folder icon to initiate it.
- Most of my existing projects, with asset links present, seem to work fine but not tested that exhaustively.
- Some of the assets I have present I have included with folders labelled folder.assets don’t appear in the Apple file manager but do in yours, and are accessible from code.
- The icon.png and icon@2X.png files seem to have disappeared from my project folders, only the plist is still present.
- Most of the sub directories, below the project icons on the main project list, have no files actually visible now but still ‘open/close’ by rotating when tapped. Only the examples and Craft examples seem to hold files - that is apart from one of my sub directories that hold three files - puzzling.
You know from my past posts that I tend to mess around with filing so it’s no surprise that I’ve picked up on these features. It will take me a little time to re-arrange but it’s all to the good to get a new and probably better filing system.
@sim - just tried to import some Codea projects from a network drive and the dialogue window loads up asking you to select the files you wish to import but doesn’t list the files or add the selector slider that is normally present. The files I was trying to import were not mine, you can unzip them and see the components present.
I’ll try to import some of my own archive files and report back.
Edit: my own file imported OK. I think the problem hinges around the file type of the Codea pages involved - when tapped on them they automatically opened in Textastic so Codea might not see them properly, hence not displaying the file for importing.
Cutting and pasting from Textastic into a new project ran OK.
i noticed that if i add an external folder through the menu Assets, it will break references to the folder through code -
asset.documents.External will not work
@skar I think I know what you’re talking about, if not then ignore this.
In the Files app, I created a folder (test4) and put a text file (dave2) in it.
From a Codea project, I selected the Asset option and did a link to the folder.
Since it was a text file I did
txt=readtext() in the code
In the brackets () I keyed asset. (asset.)
From the list just above the keyboard I selected the folder test4 then keyed another .
From the list just above the keyboard I selected the file dave2.
So the line of code was txt=readText(asset.test4.dave2)
I was able to read the file Ok.
But you’re correct that you can’t select the file from the asset list like everything else.
@skar @dave1707 - tried this out and confirm your observations.
I managed to get this working by using the files app, creating a txtTrial.assets folder in the Codea root and copying an info.plist and icon.png and icon@2X.png from another assets file. Then placing your desired text file into that assets folder. You can then load directly as @dave1707 described since the assets folder is present.
@John @sim - I posted before that I find the new folder introduction a little messy, the images of the folders are all faded out a little and there is no option there to rename or delete folders, I assume the shading out is so you know the existing folders names.
Could it work better if you opened a view of just one blank folder to name and fire up an error if that name exists?
Edit: forgot to mention - when I used @dave1707 ‘s readText() I used the info.plist file to read and it successfully read, and printed out, that file. When you create a folder using the asset dialogue it mustn’t include a default info.plist file. That should be easy to correct. Also, if it’s an assets folder you need it should name it folder.assets.
Good find! It seems like if you have the same folder in Documents as your external folder, Codea fails to pick up your folder in Documents. I’ll look into this
As a temporary workaround, you can rename the folder you use in Documents to something else
Edit: this is fixed for the next beta and the 3.9 release version
@sim - just trying out the new addressing and tried out Dropbox. I was using
Which showed me the folder and file options in my Codea folder in Dropbox, which surprised me as there are two further levels of folders needed in my Dropbox account ca.
Does Codea have the correct path taken from the downloaded Dropbox app so it sees
As the Codea folder within Dropbox ?
Also, is there any way to address network drives for asset loading ?
If you mount a network drive in the Files app, you should be able to add an external folder reference from it. Let me know if it works!
Problem - Apple files app only gives you access by IP address, whereas File Explorer (an external file app) allows you to assign a name.
How do you address a network through the Codea filing system ?
Edit: when you look at a network drive recognised by the files app and click on details it displays information but also displays the asset type as a folder.
Edit2: thought I might have a better chance with iCloud, so I tried a few variants there, mainly using string addresses, but to no avail.
@sim @john - are you currently picking up crash reports or have you delegated it to someone else. Just need to know as I posted a crash which I thought was memory related and would like to confirm since collectgarbage() at least partially resolved it.
Could you put collectgarbage into the recognised commands so it fires up whilst typing it.
Could you put an option in Codea settings for indentation on or off by default - saves me having to indent all the time.
@sim Hi, sorry to pester about this external network file issue but I’ve moved on a little.
I have 2 networked NAS drives one I use a lot which I think may be labelled inappropriately for access via a name. I can access from my Mac & PC but not my pad.
The other, I managed to set up, using the files app, with a name (and IP) so it is visible.
But I can’t address them via Codea. I have tried to use readImage() and type in the address. But it doesn’t work.
Is there any syntax necessary to place the address in the readImage() brackets so that they may be downloaded?
If I use the following syntax I am able to call up the Codea asset folder but only the usual Codea assets are present plus a link to the current project folder.
I tried clicking on the NASNAME from the files app options on the left, which opened the NAS directory folder and allowed me to go down folders to see files. But, all files present were greyed out and not selectable.
Do you use remote file access from your pad with Codea?
Edit: I’m beginning to think direct access isn’t possible and may only work like Dropbox works using a local synced folder(s).