Android-x86
Fork

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-providers-DownloadProvider: コミット

packages/providers/DownloadProvider


コミットメタ情報

リビジョン2872fb73ae4efea2d6fba20150b7126cae2805c1 (tree)
日時2009-09-15 14:42:55
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

set permission to 0711 and only after successfully mkdir

変更サマリ

差分

--- a/src/com/android/providers/downloads/Helpers.java
+++ b/src/com/android/providers/downloads/Helpers.java
@@ -181,22 +181,21 @@ public class Helpers {
181181 if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
182182 String root = Environment.getExternalStorageDirectory().getPath();
183183 base = new File(root + Constants.DEFAULT_DL_SUBDIR);
184- if (!base.isDirectory() && !base.mkdir()) {
185- if (Config.LOGD) {
186- Log.d(Constants.TAG, "download aborted - can't create base directory "
187- + base.getPath());
184+ if (!base.isDirectory()) {
185+ if (base.mkdir()) {
186+ /*
187+ * Make sure the download directory is accessible
188+ */
189+ FileUtils.setPermissions(base.getPath(),
190+ FileUtils.S_IRWXU|FileUtils.S_IXGRP|FileUtils.S_IXOTH, -1, -1);
191+ } else {
192+ if (Config.LOGD) {
193+ Log.d(Constants.TAG, "download aborted - can't create base directory "
194+ + base.getPath());
195+ }
196+ return new DownloadFileInfo(null, null, Downloads.STATUS_FILE_ERROR);
188197 }
189- return new DownloadFileInfo(null, null, Downloads.STATUS_FILE_ERROR);
190- }
191- if (base.getName().equalsIgnoreCase("download")) {
192- /*
193- * Make sure the download
194- */
195- int re = FileUtils.setPermissions(base.getPath(),
196- FileUtils.S_IRWXU|FileUtils.S_IRGRP|FileUtils.S_IXGRP|FileUtils.S_IROTH|FileUtils.S_IXOTH,
197- -1, -1);
198198 }
199-
200199 stat = new StatFs(base.getPath());
201200 } else {
202201 if (Config.LOGD) {
旧リポジトリブラウザで表示