<commit_before>// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.app.template;

import android.graphics.Color;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.View;
import android.widget.TextView;

// Added Custom import..
import java.io.*;
import android.widget.Toast;
import android.os.Environment;

import org.xwalk.app.XWalkRuntimeActivityBase;

public class AppTemplateActivity extends XWalkRuntimeActivityBase {
	
	private File mFile;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		try {
			mFile = createFile();
			if(mFile.exists()) {
				readTextFile();
			} else {
				writeTextFile();
				readTextFile();
			}
			
		} catch(IOException ex) {
			ex.printStackTrace();
		}
		
    }
	
    private File createFile() throws IOException {
        String fileName = "test.txt";	
        File storageDir = getExternalCacheDir();
        File curFile = new File(storageDir, fileName);
        return curFile;
    }
	
	private void writeTextFile() {<commit_msg>make directory on android<commit_after>// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.app.template;

import android.graphics.Color;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.View;
import android.widget.TextView;

// Added Custom import..
import java.io.*;
import android.widget.Toast;
import android.os.Environment;

import org.xwalk.app.XWalkRuntimeActivityBase;

public class AppTemplateActivity extends XWalkRuntimeActivityBase {
	
	private File mFile;
	public static final String FOLDER_SAVE = "/sdcard/TestGame/save/";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		try {
			mFile = createFile();
			if(mFile.exists()) {
				readTextFile();
			} else {
				writeTextFile();
				readTextFile();
			}
			
			createSaveFile("save.txt", "save");
			
		} catch(IOException ex) {
			ex.printStackTrace();
		}
		
    }
	
	private void createSaveFile(String filename, String raw) throws IOException  {
		
		File saveFolder = new File(FOLDER_SAVE);
		File saveFile = new File(FOLDER_SAVE + filename.toString());
		
		if(!saveFolder.isDirectory()) {
			saveFolder.mkdirs();
		}
		
		if(saveFile.exists()) {
			saveFile.delete();
		}
		
		FileOutputStream fos = new FileOutputStream(FOLDER_SAVE + filename);
		fos.write(raw.getBytes());
		fos.close();		
	
		Toast toast = Toast.makeText(getApplicationContext(), "The save file created", Toast.LENGTH_SHORT);
		toast.show();
	}
	
    private File createFile() throws IOException {
        String fileName = "test.txt";	
        File storageDir = getExternalCacheDir();
        File curFile = new File(storageDir, fileName);
        return curFile;
    }
	
	private void writeTextFile() {
{'fraction_non_alphanumeric': 0.10531220876048462, 'fraction_numerical': 0.0024852438645542093, 'mean_word_length': 3.593437945791726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6799814', 'n_tokens_mistral': 1042, 'n_tokens_neox': 922, 'n_words': 250}