package com.hh.holyolm.util;

import android.content.Context;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Utils {

    public static File initTaskDir(Context context){
        String taskPath=context.getExternalFilesDir("task").getAbsolutePath();
        File taskDir=new File(taskPath);
        if(!taskDir.exists()) taskDir.mkdirs();
        return taskDir;
    }
    public static File initLibsDir(Context context){
        String libsPath=context.getExternalFilesDir("libs").getAbsolutePath();
        File libsDir =new File(libsPath);
        if(!libsDir.exists()) libsDir.mkdirs();
        File comLibDir=new File(libsPath+File.separator+"command");
        if(!comLibDir.exists()) comLibDir.mkdirs();
        File actLibDir=new File(libsPath+File.separator+"action");
        if(!actLibDir.exists()) actLibDir.mkdirs();
        return libsDir;
    }
    public static File initDownDir(Context context){
        String taskPath=context.getExternalFilesDir("download").getAbsolutePath();
        File taskDir=new File(taskPath);
        if(!taskDir.exists()) taskDir.mkdirs();
        return taskDir;
    }

    public static String GenTimestemp(){
        Date date= new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        String str = format.format(date);
        return str;
    }
    public static String GenTimeStr(){
        Date date= new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = format.format(date);
        return str;
    }


}
