@@ -0,0 +1,2116 @@
+package org.commcare.android.resource.installers;%0A%0Aimport org.javarosa.core.reference.InvalidReferenceException;%0Aimport org.javarosa.core.reference.ReferenceManager;%0A%0Aimport java.io.File;%0A%0Apublic class FileSystemUtils %7B%0A%0A    //Hate this%0A    private static final String validExtChars = %22abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789%22;%0A%0A    public static String extension(String input) %7B%0A        int invalid = -1;%0A        //we wanna go from the last %22.%22 to the next non-alphanumeric character.%0A        for (int i = 1; i %3C input.length(); ++i) %7B%0A            if (validExtChars.indexOf(input.charAt(i)) == -1) %7B%0A                invalid = i;%0A                break;%0A            %7D%0A        %7D%0A        if (invalid == -1) %7B%0A            return input;%0A        %7D%0A        return input.substring(0, invalid);%0A    %7D%0A%0A    protected static boolean moveFrom(String oldLocation, String newLocation, boolean force) throws InvalidReferenceException %7B%0A        File newFile = new File(ReferenceManager._().DeriveReference(newLocation).getLocalURI());%0A        File oldFile = new File(ReferenceManager._().DeriveReference(oldLocation).getLocalURI());%0A%0A        if (!oldFile.exists()) %7B%0A            //Nothing should be allowed to exist in the new location except for the incoming file%0A            //due to the staging rules. If there's a file there, it's this one.%0A            return newFile.exists();%0A        %7D%0A%0A        if (oldFile.exists() && newFile.exists()) %7B%0A            //There's a destination file where this file is%0A            //trying to move to. Something might have failed to unstage%0A            if (force) %7B%0A                //If we're recovering or something, wipe out the destination.%0A                //we've gotta recover!%0A                if (!newFile.delete()) %7B%0A                    return false;%0A                %7D else %7B%0A                    //new file is gone. Let's get ours in there!%0A                %7D%0A            %7D else %7B%0A                //can't copy over an existing file. An unstage might have failed.%0A                return false;%0A            %7D%0A        %7D%0A%0A        return oldFile.renameTo(newFile);%0A    %7D%0A%7D

add back file