Revision 645f9fc5

View differences:

F-Droid/src/org/fdroid/fdroid/Utils.java
48 48
import java.io.BufferedInputStream;
49 49
import java.io.Closeable;
50 50
import java.io.File;
51
import java.io.FileDescriptor;
52 51
import java.io.FileInputStream;
53 52
import java.io.FileOutputStream;
54 53
import java.io.IOException;
......
143 142
    /**
144 143
     * Attempt to symlink, but if that fails, it will make a copy of the file.
145 144
     */
146
    public static boolean symlinkOrCopyFile(SanitizedFile inFile, SanitizedFile outFile) {
147
        return FileCompat.symlink(inFile, outFile) || copy(inFile, outFile);
145
    public static boolean symlinkOrCopyFileQuietly(SanitizedFile inFile, SanitizedFile outFile) {
146
        return FileCompat.symlink(inFile, outFile) || copyQuietly(inFile, outFile);
148 147
    }
149 148

  
150 149
    /**
......
162 161
        }
163 162
    }
164 163

  
165
    public static boolean copy(File inFile, File outFile) {
164
    public static boolean copyQuietly(File inFile, File outFile) {
166 165
        InputStream input = null;
167 166
        OutputStream output = null;
168 167
        try {
F-Droid/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java
140 140
            SanitizedFile apkFile = SanitizedFile.knownSanitized(appInfo.publicSourceDir);
141 141
            SanitizedFile fdroidApkLink = new SanitizedFile(webRoot, "fdroid.client.apk");
142 142
            attemptToDelete(fdroidApkLink);
143
            if (Utils.symlinkOrCopyFile(apkFile, fdroidApkLink))
143
            if (Utils.symlinkOrCopyFileQuietly(apkFile, fdroidApkLink))
144 144
                fdroidClientURL = "/" + fdroidApkLink.getName();
145 145
        } catch (PackageManager.NameNotFoundException e) {
146 146
            Log.e(TAG, "Could not set up F-Droid apk in the webroot", e);
......
220 220
    private void symlinkFileElsewhere(String fileName, String symlinkPrefix, File directory) {
221 221
        SanitizedFile index = new SanitizedFile(directory, fileName);
222 222
        attemptToDelete(index);
223
        Utils.symlinkOrCopyFile(new SanitizedFile(new File(directory, symlinkPrefix), fileName), index);
223
        Utils.symlinkOrCopyFileQuietly(new SanitizedFile(new File(directory, symlinkPrefix), fileName), index);
224 224
    }
225 225

  
226 226
    private void deleteContents(File path) {
......
249 249

  
250 250
            if (app.installedApk != null) {
251 251
                SanitizedFile outFile = new SanitizedFile(repoDir, app.installedApk.apkName);
252
                if (Utils.symlinkOrCopyFile(app.installedApk.installedFile, outFile))
252
                if (Utils.symlinkOrCopyFileQuietly(app.installedApk.installedFile, outFile))
253 253
                    continue;
254 254
            }
255 255
            // if we got here, something went wrong
F-Droid/src/org/fdroid/fdroid/net/ApkDownloader.java
21 21
package org.fdroid.fdroid.net;
22 22

  
23 23
import android.content.Context;
24
import android.os.Build;
25 24
import android.content.Intent;
26 25
import android.os.Bundle;
27 26
import android.support.annotation.NonNull;
......
39 38

  
40 39
import java.io.File;
41 40
import java.io.IOException;
42
import java.net.URL;
43 41
import java.security.NoSuchAlgorithmException;
44 42

  
45 43
/**
......
188 186
        // Can we use the cached version?
189 187
        if (verifyOrDelete(potentiallyCachedFile)) {
190 188
            delete(localFile);
191
            Utils.copy(potentiallyCachedFile, localFile);
189
            Utils.copyQuietly(potentiallyCachedFile, localFile);
192 190
            prepareApkFileAndSendCompleteMessage();
193 191
            return false;
194 192
        }
......
243 241
    private void cacheIfRequired() {
244 242
        if (Preferences.get().shouldCacheApks()) {
245 243
            Utils.DebugLog(TAG, "Copying .apk file to cache at " + potentiallyCachedFile.getAbsolutePath());
246
            Utils.copy(localFile, potentiallyCachedFile);
244
            Utils.copyQuietly(localFile, potentiallyCachedFile);
247 245
        }
248 246
    }
249 247

  

Also available in: Unified diff