package com.aoleyun.sn.manager; import android.content.Context; import android.util.Log; import com.aoleyun.sn.utils.JGYUtils; import java.io.File; public class FileManager { private static FileManager sInstance; private Context mContext; public FileManager(Context context) { this.mContext = context; } public static void init(Context context) { if (sInstance == null) { sInstance = new FileManager(context); initFolder(); } } public static FileManager getInstance() { if (sInstance == null) { throw new IllegalStateException("You must be init FileManager first"); } return sInstance; } private static void initFolder() { File file = new File(JGYUtils.getInstance().getDownLoadPath()); if (!file.exists()) { if (file.mkdirs()) { Log.e("initFolder", "initFolder: success"); } else { Log.e("initFolder", "initFolder: failed"); } } } }