ソースを参照

处理音频清空返回为空及无法继续录音的问题

leijie 8 年 前
コミット
9b413c6ea0
共有1 個のファイルを変更した17 個の追加1 個の削除を含む
  1. 17 1
      wade-mobile-func/src/com/wade/mobile/func/MobileFile.java

+ 17 - 1
wade-mobile-func/src/com/wade/mobile/func/MobileFile.java

@ -34,7 +34,7 @@ public class MobileFile extends Plugin{
34 34
	
35 35
	public void cleanResource(String relativePath, boolean isSdcard) {
36 36
		String absolutePath = util.getDirection(relativePath, isSdcard);
37
		FileUtil.deleteDir(absolutePath);
37
		cleanDir(new File(absolutePath));
38 38
		
39 39
		String[] fileList = new File(absolutePath).list();
40 40
		if (fileList.length == 0) {
@ -44,6 +44,22 @@ public class MobileFile extends Plugin{
44 44
		}
45 45
	}
46 46
	
47
	/**
48
	 * 清空文件夹
49
	 */
50
	private boolean cleanDir(File dir){
51
		if(dir.isDirectory()){
52
			String[] children = dir.list();
53
			for(int i = 0;i < children.length; i++){
54
				boolean success = FileUtil.deleteDir(new File(dir, children[i]));
55
				if(!success){
56
					return false;
57
				}
58
			}
59
		}
60
		return true;
61
	}
62
	
47 63
	public void getAllFile(JSONArray param) throws Exception{
48 64
		String fileName = param.getString(0); //相对路径参数
49 65
		String type = param.getString(1);