brouter/brouter-routing-app/src/main/java/btools/routingapp/ConfigHelper.java
Manuel Fuhr 54d5c5e943 Reformat files using Android Studio
android-studio/bin/format.sh -m '*.java' -r brouter-routing-app

To rebase active branches on top of the new master just rebase your
branch onto the commit prior to the reformatting and format every commit
of your branch using (<commit> should be replaced by this commit)

git rebase \
        --strategy-option=theirs \
        --onto <commit> \
        --exec 'format.sh -m "*.java" -r brouter-routing-app' \
        --exec 'git commit --all --no-edit --amend' \
        <commit>~

To ignore this mass edit during git blame see `.git-blame-ignore-revs`
2021-11-20 16:50:23 +01:00

34 lines
1.1 KiB
Java

package btools.routingapp;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.File;
import android.content.Context;
public class ConfigHelper {
public static File getBaseDir(Context ctx) {
// get base dir from private file
try (InputStream configInput = ctx.openFileInput("config15.dat");
InputStreamReader isr = new InputStreamReader(configInput);
BufferedReader br = new BufferedReader(isr)) {
return new File(br.readLine());
} catch (Exception e) {
return null;
}
}
public static void writeBaseDir(Context ctx, File baseDir) {
try (OutputStream configOutput = ctx.openFileOutput("config15.dat", Context.MODE_PRIVATE);
OutputStreamWriter osw = new OutputStreamWriter(configOutput);
BufferedWriter bw = new BufferedWriter(osw)) {
bw.write(baseDir.getAbsolutePath());
bw.write('\n');
} catch (Exception e) { /* ignore */ }
}
}