Skip to content

Instantly share code, notes, and snippets.

@nerzid
Created April 1, 2017 12:53
Show Gist options
  • Save nerzid/e022f9f1434bfd7b8b3551a6dbcd0757 to your computer and use it in GitHub Desktop.
Save nerzid/e022f9f1434bfd7b8b3551a6dbcd0757 to your computer and use it in GitHub Desktop.
public class NewClass {
public static boolean chooseDB() throws FileNotSelected {
File f = null;
if (!checkIfDatabaseIsInProject()) {
f = FilePicker.chooseDBFile();
if (f == null) {
return false;
}
} else {
f = new File("../db/autocomment.db");
if (f == null) {
return false;
}
if (!f.exists()) {
return false;
}
}
DB_FILE_PATH = f.getPath();
System.out.println(DB_FILE_PATH);
System.out.println("Database choosen.");
isSet = true;
return true;
}
private static boolean checkIfDatabaseIsInProject() {
return new File("../db/autocomment.db").exists();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment