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
@@ -181,22 +181,21 @@ public class Helpers { | ||
181 | 181 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { |
182 | 182 | String root = Environment.getExternalStorageDirectory().getPath(); |
183 | 183 | 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); | |
188 | 197 | } |
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); | |
198 | 198 | } |
199 | - | |
200 | 199 | stat = new StatFs(base.getPath()); |
201 | 200 | } else { |
202 | 201 | if (Config.LOGD) { |