get absolute path to a file from the name so that we can read it.

This commit is contained in:
Zeapo 2014-07-27 23:07:53 +01:00
parent f738c7ee36
commit e9be4bf8d0
2 changed files with 14 additions and 1 deletions

View file

@ -60,6 +60,10 @@ public class PasswordRepository {
return mainPasswordMap;
}
public static File getFile(String name) {
return new File(repository.getWorkTree() + "/" + name);
}
public static ArrayList<String> getFilesList(File path){
List<File> files = (List<File>) FileUtils.listFiles(path, new String[] {"gpg"}, true);
ArrayList<String> filePaths = new ArrayList<String>();

View file

@ -31,6 +31,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
@ -115,7 +116,15 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
/* If an item is clicked in the list of passwords, this will be triggered */
@Override
public void onFragmentInteraction(String id) {
System.out.println(id + " Clicked");
try {
for (String l : (List<String>) FileUtils.readLines(PasswordRepository.getFile(id), null)) {
System.out.println(l);
}
} catch (IOException e) {
//TODO handle problems
e.printStackTrace();
}
}
}