Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.IOException;

import android.util.Log;

public class Main {
    /** Create the EasyRPG's directories in path it's possible */
    public static boolean createEasyRPGDirectories(String path) {
        //Main folder
        File dir = new File(path);
        dir.mkdir();

        //Games' folder
        File dirGames = new File(dir, "games/");
        dirGames.mkdir();

        //RTP's folders
        File dirRtp = new File(dir, "rtp/");
        dirRtp.mkdir();
        File dirRtp2000 = new File(dirRtp, "2000");
        dirRtp2000.mkdir();
        File dirRtp2003 = new File(dirRtp, "2003");
        dirRtp2003.mkdir();

        // The .nomedia file (to not let app scan games and RTP's folders)
        File nomediafile = new File(dir, ".nomedia");
        try {
            nomediafile.createNewFile();
        } catch (IOException e) {
            Log.e("Create File", "Error creating .nomedia file");
        }

        //TODO : Verify if all the folders exists
        return true;
    }
}