project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/util/FileUtils.java
author Medo <smaxein@googlemail.com>
Wed, 22 Aug 2012 01:30:56 +0200
changeset 7586 33924ff4af50
parent 7584 7831c84cc644
child 10017 de822cd3df3a
permissions -rw-r--r--
Hedgeroid: Some code cleanup, adding a forgotten file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     1
/*
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
6700
e04da46ee43c the most important commit of the year
koda
parents: 6486
diff changeset
     3
 * Copyright (c) 2011-2012 Richard Deurwaarder <xeli@xelification.com>
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
     4
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     5
 *
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
     6
 * This program is free software; you can redistribute it and/or
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
     7
 * modify it under the terms of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
     8
 * as published by the Free Software Foundation; either version 2
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
     9
 * of the License, or (at your option) any later version.
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    10
 *
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful,
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    14
 * GNU General Public License for more details.
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    15
 *
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    17
 * along with this program; if not, write to the Free Software
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
    18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    19
 */
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    20
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
    21
package org.hedgewars.hedgeroid.util;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    22
7344
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
    23
import java.io.ByteArrayOutputStream;
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    24
import java.io.Closeable;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    25
import java.io.File;
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    26
import java.io.FileNotFoundException;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    27
import java.io.FileOutputStream;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    28
import java.io.IOException;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    29
import java.io.InputStream;
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    30
import java.io.OutputStream;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    31
import java.util.ArrayList;
6486
2a3ee24764bb android: startgamemenu now has some default values, plus the themes are ordered alphabetically
Xeli
parents: 6456
diff changeset
    32
import java.util.List;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    33
6839
2dd2c0f2c9d0 Remove API Level 8 dependency found by Android Lint
Medo <smaxein@googlemail.com>
parents: 6700
diff changeset
    34
import android.annotation.TargetApi;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    35
import android.content.Context;
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    36
import android.content.res.Resources;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    37
import android.content.res.TypedArray;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    38
import android.os.Build;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    39
import android.os.Environment;
6350
41b0a9955c47 new download manager \o/
Xeli
parents: 6049
diff changeset
    40
import android.util.Log;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    41
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
    42
public class FileUtils {
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    43
	private static final String ROOT_DIR = "Data";
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
    44
	private static final String TAG = FileUtils.class.getSimpleName();
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    45
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    46
	/**
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    47
	 * @return true if the data path is currently available. However, it can vanish at any time so
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    48
	 * normally you should just try to use it and rely on the exceptions.
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    49
	 */
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    50
	public static boolean isDataPathAvailable() {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    51
		return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    52
	}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    53
	
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    54
	/**
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    55
	 * get the path to which we should download all the data files
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    56
	 * @param c context 
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    57
	 * @return The directory
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
    58
	 * @throws FileNotFoundException if external storage is not available at the moment
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    59
	 */
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    60
	public static File getCachePath(Context c) throws FileNotFoundException {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    61
		File cachePath = null;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    62
		if(Build.VERSION.SDK_INT < 8){//8 == Build.VERSION_CODES.FROYO
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    63
			cachePath = PreFroyoSDCardDir.getDownloadPath(c);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    64
		} else {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    65
			cachePath = FroyoSDCardDir.getDownloadPath(c);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    66
		}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    67
		if(cachePath==null) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    68
			throw new FileNotFoundException("External storage is currently unavailable");
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    69
		} else {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    70
			return cachePath;
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    71
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    72
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
    73
7586
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    74
	public static File getDataPathFile(Context c, String...subpath) throws FileNotFoundException {
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    75
		File file = new File(getCachePath(c), ROOT_DIR);
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    76
		for(String pathcomponent : subpath) {
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    77
			file = new File(file, pathcomponent);
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    78
		}
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
    79
		return file;
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    80
	}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    81
	
6839
2dd2c0f2c9d0 Remove API Level 8 dependency found by Android Lint
Medo <smaxein@googlemail.com>
parents: 6700
diff changeset
    82
	@TargetApi(8)
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    83
	private static class FroyoSDCardDir{
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    84
		public static File getDownloadPath(Context c){
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    85
			return c.getExternalCacheDir();
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    86
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    87
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
    88
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    89
	private static class PreFroyoSDCardDir{
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    90
		public static File getDownloadPath(Context c){
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    91
			if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    92
				File extStorageDir = Environment.getExternalStorageDirectory();
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    93
				if(extStorageDir != null) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    94
					return new File(extStorageDir, "Hedgewars");
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
    95
				}
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    96
			}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    97
			return null;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    98
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    99
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   100
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   101
	/**
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   102
	 * Return a File array with all the files from dirName
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   103
	 * @param c
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   104
	 * @param dirName
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   105
	 * @return
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   106
	 * @throws FileNotFoundException If the sdcard is not available or the subdirectory "dirName" does not exist
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   107
	 */
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   108
	public static File[] getFilesFromRelativeDir(Context c, String dirName) throws FileNotFoundException {
7586
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
   109
		File f = getDataPathFile(c, dirName);
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   110
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   111
		if(f.isDirectory()) {
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   112
			return f.listFiles();
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   113
		} else {
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   114
			throw new FileNotFoundException("Directory "+dirName+" does not exist.");
6350
41b0a9955c47 new download manager \o/
Xeli
parents: 6049
diff changeset
   115
		}
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   116
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   117
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   118
	/**
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   119
	 * Checks if this directory has a file with suffix suffix
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   120
	 * @param f - directory
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   121
	 * @return
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   122
	 */
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   123
	public static boolean hasFileWithSuffix(File f, String suffix){
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   124
		if(f.isDirectory()){
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   125
			for(String s : f.list()){
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   126
				if(s.endsWith(suffix)) return true;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   127
			}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   128
			return false;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   129
		}else{
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   130
			return false;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   131
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   132
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   133
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   134
	/**
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   135
	 * Gives back all dirs which contain a file with suffix fileSuffix
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   136
	 * @param c
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   137
	 * @param path
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   138
	 * @param fileSuffix
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   139
	 * @return
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   140
	 * @throws FileNotFoundException If the sdcard is not available or the subdirectory "path" does not exist
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   141
	 */
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   142
	public static List<String> getDirsWithFileSuffix(Context c, String path, String fileSuffix) throws FileNotFoundException{
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   143
		File[] files = getFilesFromRelativeDir(c,path);
6486
2a3ee24764bb android: startgamemenu now has some default values, plus the themes are ordered alphabetically
Xeli
parents: 6456
diff changeset
   144
		ArrayList<String> ret = new ArrayList<String>();
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   145
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   146
		for(File f : files){
6486
2a3ee24764bb android: startgamemenu now has some default values, plus the themes are ordered alphabetically
Xeli
parents: 6456
diff changeset
   147
			if(hasFileWithSuffix(f, fileSuffix)) ret.add(f.getName());
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   148
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   149
		return ret;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   150
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   151
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   152
	/**
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   153
	 * Get all files from directory dir which have the given suffix
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   154
	 * @throws FileNotFoundException If the sdcard is not available or the subdirectory "dir" does not exist
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   155
	 */
7586
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
   156
	public static List<String> getFileNamesFromDirWithSuffix(Context c, String dir, String suffix, boolean removeSuffix) throws FileNotFoundException{
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   157
		File[] files = FileUtils.getFilesFromRelativeDir(c, dir);
7586
33924ff4af50 Hedgeroid: Some code cleanup, adding a forgotten file
Medo <smaxein@googlemail.com>
parents: 7584
diff changeset
   158
		List<String> ret = new ArrayList<String>();
7485
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   159
		for(File file : files){
0481bd74267c Hedgeroid:
Medo <smaxein@googlemail.com>
parents: 7476
diff changeset
   160
			String s = file.getName();
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   161
			if(s.endsWith(suffix)){
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   162
				if(removeSuffix) ret.add(s.substring(0, s.length()-suffix.length()));
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   163
				else ret.add(s);
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   164
			}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   165
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   166
		return ret;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   167
	}
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   168
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   169
	/**
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   170
	 * Close a resource (possibly null), ignoring any IOException.
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   171
	 */
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   172
	public static void closeQuietly(Closeable c) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   173
		if(c!=null) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   174
			try {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   175
				c.close();
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   176
			} catch(IOException e) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   177
				Log.w(TAG, e);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   178
			}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   179
		}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   180
	}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   181
	
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   182
	/**
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   183
	 * Write all data from the input stream to the file, creating or overwriting it.
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   184
	 * The input stream will be closed.
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   185
	 * 
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   186
	 * @throws IOException
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   187
	 */
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   188
	public static void writeStreamToFile(InputStream is, File file) throws IOException {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   189
		OutputStream os = null;
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   190
		byte[] buffer = new byte[8192];
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   191
		try {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   192
			os = new FileOutputStream(file);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   193
			int size;
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   194
			while((size=is.read(buffer)) != -1) {
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   195
				os.write(buffer, 0, size);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   196
			}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   197
			os.close(); // Important to close this non-quietly, in case of exceptions when flushing
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   198
		} finally {
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   199
			FileUtils.closeQuietly(is);
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   200
			FileUtils.closeQuietly(os);
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   201
		}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   202
	}
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   203
	
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   204
	/**
6456
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   205
	 * Moves resources pointed to by sourceResId (from @res/raw/) to the app's private data directory
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   206
	 * @param c
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   207
	 * @param sourceResId
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   208
	 * @param directory
fed715edc3ee android: check if the sdcard directory is writable, if it isn't close the app
Xeli
parents: 6350
diff changeset
   209
	 */
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   210
	public static void resRawToFilesDir(Context c, int sourceResId, int targetFilenames, String directory) throws IOException {
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   211
		File targetDir = new File(c.getFilesDir(), directory);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   212
		targetDir.mkdirs();
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   213
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   214
		//Get an array with the resource files ID
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   215
		Resources resources = c.getResources();
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   216
		TypedArray ta = resources.obtainTypedArray(sourceResId);
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   217
		TypedArray filenames = resources.obtainTypedArray(targetFilenames);
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   218
		for(int i = 0; i < ta.length(); i++){
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   219
			int resId =  ta.getResourceId(i, 0);
7508
763d3961400b Hedgeroid: Frantic scrabbling toward the deadline
Medo <smaxein@googlemail.com>
parents: 7485
diff changeset
   220
			String fileName = filenames.getString(i);
7318
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   221
			File f = new File(targetDir, fileName);
a446eafcddeb Improved asset moving time by an order of magnitude (3s vs. 25s on my device)
Medo <smaxein@googlemail.com>
parents: 6839
diff changeset
   222
			writeStreamToFile(resources.openRawResource(resId), f);
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   223
		}
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   224
	}
7344
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   225
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   226
	public static String readToString(InputStream is) throws IOException {
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   227
		try {
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   228
			ByteArrayOutputStream os = new ByteArrayOutputStream();
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   229
			byte[] buffer = new byte[8192];
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   230
			int size;
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   231
			while((size=is.read(buffer)) != -1) {
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   232
				os.write(buffer, 0, size);
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   233
			}
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   234
			return new String(os.toByteArray());
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   235
		} finally {
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   236
			closeQuietly(is);
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   237
		}
25b8906f901a Hedgeroid: Modified detection of assets on SD card (should be more reliable)
Medo <smaxein@googlemail.com>
parents: 7332
diff changeset
   238
	}
7476
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   239
	
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   240
	private static final char[] badFilenameChars = new char[] { '/', '\\', ':', '*', '?', '\"', '<', '>', '|', '.', '\0' };
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   241
	
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   242
	/**
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   243
	 * Modify the given String so that it can be used as part of a filename
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   244
	 * without causing problems from illegal/special characters.
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   245
	 * 
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   246
	 * The result should be similar to the input, but isn't necessarily
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   247
	 * reversible.
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   248
	 */
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   249
	public static String replaceBadChars(String name) {
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   250
		if (name == null || name.trim().length()==0) {
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   251
			return "_";
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   252
		}
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   253
		name = name.trim();
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   254
		for (char badChar : badFilenameChars) {
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   255
			name = name.replace(badChar, '_');
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   256
		}
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   257
		return name;
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents: 7344
diff changeset
   258
	}
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
   259
}