Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 029ba4ca authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

fix e/wiki/en#2, e/apps/eDrive#9

parent f8c542e3
Loading
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ import io.eelo.drive.operations.UploadFileOperation;
import io.eelo.drive.utils.AppConstants;
import io.eelo.drive.utils.CommonUtils;
import io.eelo.drive.utils.IGetOCClient;

import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR;
import static io.eelo.drive.utils.AppConstants.INITIALIZERSERVICE_HAS_RUN;


@@ -465,9 +467,19 @@ public class ObserverService extends Service implements OnRemoteOperationListene
            fileContents.append( currentPackage.packageName).append(",").append(currentPackage.versionName).append("\n");
        }
        try {
            FileOutputStream outputStream = openFileOutput(AppConstants.APPLICATIONS_LIST_FILE_NAME, Context.MODE_PRIVATE);
            outputStream.write(fileContents.toString().getBytes());
            outputStream.close();
            FileOutputStream tmp = openFileOutput(AppConstants.APPLICATIONS_LIST_FILE_NAME_TMP, Context.MODE_PRIVATE);
            tmp.write(fileContents.toString().getBytes());
            tmp.close();

            String filesdir = getFilesDir().getCanonicalPath()+PATH_SEPARATOR;
            File tmp_file = new File(filesdir+AppConstants.APPLICATIONS_LIST_FILE_NAME_TMP);
            File real_file = new File(filesdir+AppConstants.APPLICATIONS_LIST_FILE_NAME);

            if ( tmp_file.length() != real_file.length() ) {
                tmp_file.renameTo(real_file);
            } else {
                tmp_file.delete();
            }
        } catch (Exception e) {
            Log.e(TAG, "Can't save file with package list: "+e.toString());
        }
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ public abstract class AppConstants {
    public static final String INITIALIZERSERVICE_HAS_RUN="initService_has_run";
    public static final String INITIALFOLDERS_NUMBER="initial_folder_number";
    public static final String APPLICATIONS_LIST_FILE_NAME = "packages_list.csv";
    public static final String APPLICATIONS_LIST_FILE_NAME_TMP = "tmp_packages_list.csv";
    public static final String SHARED_PREFERENCE_NAME ="preferences";

    public static final String[] MEDIA_SYNCABLE_CATEGORIES = new String[]{"Images", "Movies", "Music", "Ringtones", "Documents", "Podcasts"};