6 Aug 2010 rbp   » (Journeyer)

ASE is now SL4A! Upgrade (and here's how)!

So, SL4A r0 is out! This is good old Android Scripting Environment, or ASE (remember?), renamed to Scripting Layer for Android, but that's not all. The release also brings a lot of really cool features, such as:

  • Interpreters distributed on their own APKs. Plus the coolness factor of seeing "Python for Android" on the installer. Downloading them is bit weird, though, as it opens the browser and hitting the Back buttons takes you to the homepage, not back to AS4L.

  • Scripts themselves can be packed into an APK

  • Support for multiple scripts running simultaneously, on the background.

And a lot more. Do read the announcement.

So, yeah, head over to the project's page (BTW, why isn't it on the Market?) and install the new version.

However, if you already used ASE, you'll notice that the new package no longer replaces the old ASE installation. It installs as a different app. No problems so far.

But it also won't find your old scripts! Oops... SL4A now stores (and looks for) its scripts on /sdcard/sl4a, instead of the previously used /sdcard/ase.

Fortunately, that's very easy to fix, with a small shell script running on SL4A itself:

  # Just install this on your sl4a and run it once.
enough () {
    echo $1
    echo "Press ENTER to exit... "
    read foo
    exit $2

if ! cd "$old" ; then
    enough "Could not cd to old scripts directory $old. Sorry." 1
if [ ! -d "$new" ]; then
    if ! mkdir "$new"; then
        enough "Could not create new scripts directory $new. Sorry." 1
find . -type d -mindepth 1 -exec mkdir "$new/{}" \; 2>/dev/null
find . -type f | while read line; do
    if [ ! -e "$new/$line" ]; then
        echo "$line -> $new/$line"
        cp "$line" "$new/$line"

enough "Done." 0


This basically just copies the files over (including from any subdirectories you might have), without overwriting any files that already exist on the SL4A scripts directory. You can install it from the QR Code on the right (click it for a larger version). I realise that I should put SL4A's new functionality to test and pack the script in an APK file, but I'm feeling a bit lazy for that right now. If enough people actually use the script, I'll give it a shot :)

I'm using shell because it comes with SL4A, so you don't have to download any specific interpreter. Also, I'm hardcoding the /sdcard path, since I believe SL4A doesn't expose the getExternalStorageDir() call. If your SD card's mount point is somewhere else, please adjust the script accordingly (or, if there's another commonly used path, let me know and I'll fix it here).

Enough for now. Let me know if this script has been useful, or if you have suggestions.

Have fun with SL4A!

Syndicated 2010-08-05 23:50:11 from Bits of rbp - isnomore.net

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!