Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ private Installer() { }

private final String FREENET_INI = "freenet.ini";
private final String SEEDNODES = "seednodes.fref";
private final String BOOKMARKS = "bookmarks.dat";

public static Installer getInstance() {
if (instance == null) {
Expand All @@ -35,10 +36,11 @@ public static Installer getInstance() {
* @param path Path to installation location.
* @param seeds Input stream of seeds file.
* @param config Input stream of default configuration.
* @param bookmarks Input stream of default bookmarks
*
* @throws FileNotFoundException
*/
public void install(String path, InputStream seeds, InputStream config, String lang) throws FileNotFoundException {
public void install(String path, InputStream seeds, InputStream config, InputStream bookmarks, String lang) throws FileNotFoundException {
File f = new File(path);
if (!f.exists() || !f.canWrite()) {
throw new FileNotFoundException("Invalid installation directory: " + path);
Expand All @@ -49,6 +51,7 @@ public void install(String path, InputStream seeds, InputStream config, String l
// Install bundled configurations
createConfiguration(seeds, getSeednodesPath());
createConfiguration(config, getFreenetIniPath());
createConfiguration(bookmarks, getBookmarksPath());

// Update freenet.ini with dynamic configuration
final FileOutputStream ini = new FileOutputStream(getFreenetIniPath(), true);
Expand Down Expand Up @@ -138,4 +141,8 @@ public String getSeednodesPath() {
public String getFreenetIniPath() {
return path + "/" + FREENET_INI;
}

public String getBookmarksPath() {
return path + "/" + BOOKMARKS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public int startService(Context context) {
context.getDir("data", Context.MODE_PRIVATE).getAbsolutePath(),
res.openRawResource(R.raw.seednodes),
res.openRawResource(R.raw.freenet),
res.openRawResource(R.raw.bookmarks),
res.getConfiguration().locale.getDisplayLanguage()
);
} catch (FileNotFoundException e) {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/raw/bookmarks.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BookmarkCategory=4
Version=1
End