One of the shortcomings of iDevices is that you are unable to easily access the documents on your iDevice from a computer. You have to have iTunes installed and you need to set the device to sync with the machine in order to access the files on your iDevice. This is quite impractical because the iDevice could be used to transfer documents and carry them around as well as editing them on your device. A good example is going over to a friends house and taking a document along with you that you both want to work on. The options for transferring the document to your friend's computer are fairly limited, perhaps the most easy being to transfer it to DropBox first via a folder that both you and your friend share. This is extremely impractical.
This tutorial explains and implements a mechanism to access all your app documents from a computer over the network without the need for iTunes.
netatalk
(either from Cydia or compiled by yourself)
We are going to create a shell script that will run periodically on your device in order to generate mount-points of the Documents
folder found in all applications that store data. Furthermore, we are going to filter the Documents
folder to determine whether it contains files. Otherwise, we exclude the application and we do not generate a mount-point.
First make sure that by installing netatalk
from Cydia (or compiled yourself) you are able to browse the "home" and "root" directories using Finder. If you are able to do so, then you are all set and you can proceed with the next steps.
Recommended BossTools
package from cydia.appvolumes.sh
in the /usr/bin/
directory with the following contents:#!/bin/bash # Copyright (C) Wizardry and Steamworks. # Generate afpd mountpoints for applications # containing a non-empty Documents folder # in order to access the application files. APPS_DIRECTORY='/private/var/mobile/Applications' NETATALK_CONFIG_DIRECTORY='/etc/netatalk/' NETATALK_CONFIG_FILE='AppleVolumes.default' # Sanity checks. if [ ! -d $NETATALK_CONFIG_DIRECTORY ] || [ ! -f $NETATALK_CONFIG_DIRECTORY/$NETATALK_CONFIG_FILE ]; then echo "Netatalk configuration not found, cannot proceed." fi # Clean file of previous entries. sed -i'' -n '/Applications/!p' $NETATALK_CONFIG_DIRECTORY/$NETATALK_CONFIG_FILE # Find folders and add to afpd configure file. data=() IFS=$'\n' for UUID in `find $APPS_DIRECTORY/ -name Documents | awk 'BEGIN {FS="/"} { print $6 }'`; do for APP_FOLDER in `ls -d $APPS_DIRECTORY/$UUID/*.app | awk 'BEGIN {FS="/"} { print $7}'`; do if [ "$(ls -A $APPS_DIRECTORY/$UUID/Documents)" ]; then NAME=`echo $APP_FOLDER | awk 'BEGIN { FS = "." } { print $1 }'` data[$[${#data[@]}+1]]="$APPS_DIRECTORY/$UUID/Documents \"$NAME\"" fi done done # Time of surprise to time of rape, that's why. printf "%s\n" "${data[@]}" >> $NETATALK_CONFIG_DIRECTORY/$NETATALK_CONFIG_FILE AFPD_PID=`ps -ax | grep '[a]fpd' | awk '{print $1}'` if [ !-z $APFD_PID ]; then kill -s HUP $AFPD_PID fi
org.grimore.appvolumes.plist
in the directory /Library/LaunchDaemons
with the following contents:<plist version="1.0"> <dict> <key>Label</key> <string>org.grimore.appvolumes</string> <key>Program</key> <string>/usr/bin/appvolumes.sh</string> <key>RunAtLoad</key> <true/> <key>StartInterval</key> <integer>3600</integer> </dict> </plist>
/Library/LaunchDaemons/org.grimore.appvolumes.plist
by using the following command:launchctl load -w /Library/LaunchDaemons/org.grimore.appvolumes.plist
The script will run every hour, so if you have installed a new application and it does not show up, then you will have to wait. The setting responsible for that is in the playlist:
<key>StartInterval</key> <integer>3600</integer>
which you can change to any value. In this case, the appvolumes.sh
script will run every 3600s (1 hour) and look for applications that store documents on your iDevice.
A good example that was tested, was to transfer text documents to an iDevice with the Textastic
application installed. The Textastic
application holds all the text files in the Documents folder.
The folder structure of an application is given by the following sketch:
/private/var/mobile/Applications/ UUID / + | +-- Documents/ | | +-- Application.app/
where UUID is the application UUID. The application (Application.app
in this case) stores all its documents in the Documents
folder. This is also how some games work by storing save-game files in the Documents
folder. It sometimes happens that you uninstall an application or load (yet-another) a iOS update and all your saves are lost. This way you will be able to conveniently back them up and put them back.
This system uses netatalk which is specific for OSX and can be read on Linux but there is no Windows support. For that, a better choice perhaps would be to use Samba instead.
Another observation is that the Documents
folders of applications may contain files that are not common (for example sqlite databases that do not always need to be fiddled or modified) so it would be possible to include a filter that creates mount-points for applications that store txt
, JPG
, etc… file-types.
One unfortunate consequence of using netatalk and the reason why we create mount-points in stead of creating a directory of symlinks and sharing that, is that netatalk v2 (the latest and current one on Cydia) has no support for symlinks. That is, even though the links would appear as folders, all the folders would be empty. This is perhaps what is most worrying because that results in the creation of quite some mount-points (depending on how many applications you have that store data) and it looks a bit untidy. It would be nice to create a mount-point called "Applications" and under that folder have the documents applications folder.