зеркало из https://github.com/mozilla/gecko-dev.git
bug 622684 - updates should not be downloaded to "<sdcard>/downloads" r=mbrubeck a=blocking-fennec
This commit is contained in:
Родитель
410256668b
Коммит
fc0101bc3e
|
@ -425,10 +425,16 @@ abstract public class GeckoApp
|
|||
Log.i("GeckoAppJava", "Checking for an update");
|
||||
|
||||
int statusCode = 8; // UNEXPECTED_ERROR
|
||||
File downloadDir = null;
|
||||
if (Build.VERSION.SDK_INT >= 8)
|
||||
downloadDir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
||||
else
|
||||
downloadDir = new File(Environment.getExternalStorageDirectory().getPath(), "download");
|
||||
|
||||
String updateDir = Environment.getExternalStorageDirectory().getPath() + "/downloads/updates/0/";
|
||||
File updateFile = new File(updateDir + "update.apk");
|
||||
File statusFile = new File(updateDir + "update.status");
|
||||
File updateDir = new File(new File(downloadDir, "updates"),"0");
|
||||
|
||||
File updateFile = new File(updateDir, "update.apk");
|
||||
File statusFile = new File(updateDir, "update.status");
|
||||
|
||||
if (!statusFile.exists() || !readUpdateStatus(statusFile).equals("pending"))
|
||||
return;
|
||||
|
|
|
@ -118,8 +118,13 @@ class GeckoAppShell
|
|||
GeckoAppShell.putenv("TMPDIR=" + f.getPath());
|
||||
|
||||
f = Environment.getDownloadCacheDirectory();
|
||||
GeckoAppShell.putenv("EXTERNAL_STORAGE" + f.getPath());
|
||||
|
||||
GeckoAppShell.putenv("EXTERNAL_STORAGE=" + f.getPath());
|
||||
File downloadDir = null;
|
||||
if (Build.VERSION.SDK_INT >= 8)
|
||||
downloadDir = GeckoApp.mAppContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
||||
else
|
||||
downloadDir = new File(Environment.getExternalStorageDirectory().getPath(), "download");
|
||||
GeckoAppShell.putenv("DOWNLOADS_DIRECTORY=" + downloadDir.getPath());
|
||||
GeckoAppShell.putenv("LANG=" + Locale.getDefault().toString());
|
||||
|
||||
loadLibs(apkName);
|
||||
|
|
|
@ -1183,13 +1183,11 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
|
|||
#elif defined(ANDROID)
|
||||
// Android doesn't have a $HOME directory, and by default we only have
|
||||
// write access to /data/data/org.mozilla.{$APP} and /sdcard
|
||||
char* sdcard = getenv("EXTERNAL_STORAGE");
|
||||
if (sdcard) {
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(sdcard),
|
||||
char* downloadDirPath = getenv("DOWNLOADS_DIRECTORY");
|
||||
if (downloadDirPath) {
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(downloadDirPath),
|
||||
PR_TRUE, getter_AddRefs(downloadDir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = downloadDir->Append(NS_LITERAL_STRING("downloads"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
|
|
@ -468,16 +468,14 @@ static nsresult GetDownloadDirectory(nsIFile **_directory)
|
|||
// system, and don't save downloads to temp directories
|
||||
|
||||
// On Android we only return something if we have and SD-card
|
||||
char* sdcard = getenv("EXTERNAL_STORAGE");
|
||||
char* downloadDir = getenv("DOWNLOADS_DIRECTORY");
|
||||
nsresult rv;
|
||||
if (sdcard) {
|
||||
if (downloadDir) {
|
||||
nsCOMPtr<nsILocalFile> ldir;
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(sdcard),
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(downloadDir),
|
||||
PR_TRUE, getter_AddRefs(ldir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ldir->Append(NS_LITERAL_STRING("downloads"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
dir = ldir;
|
||||
dir = do_QueryInterface(ldir);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче