summaryrefslogtreecommitdiff
path: root/navit/android/src/org/navitproject/navit/NavitMap.java
blob: b7bd265a4917942ff784931c3ab42572331416a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.navitproject.navit;

import java.io.File;

public class NavitMap {
	String fileName;
	String mapName;
	String mapPath;

	public NavitMap(String path, String map_file_name) {
		mapPath = path;
		fileName = map_file_name;
		if (map_file_name.endsWith(".bin")) {
			mapName = map_file_name.substring(0, map_file_name.length() - 4);
		} else {
			mapName = map_file_name;
		}
	}

	public NavitMap(String map_location) {
		File mapFile = new File(map_location);
		
		mapPath = mapFile.getParent() + "/";
		fileName = mapFile.getName();
		if (fileName.endsWith(".bin")) {
			mapName = fileName.substring(0, fileName.length() - 4);
		} else {
			mapName = fileName;
		}
	}

	public long size() {
		File map_file = new File(mapPath + fileName);
		return map_file.length();
	}

	public String getLocation() {
		return mapPath + fileName;
	}
}