diff options
| author | Mohamed Zenadi <mohamed@zenadi.com> | 2015-05-03 12:14:50 +0200 |
|---|---|---|
| committer | Mohamed Zenadi <mohamed@zenadi.com> | 2015-05-17 18:51:28 +0200 |
| commit | 62b4d78e93200ce46fa82dc00e0aa7a3083ff2f0 (patch) | |
| tree | 1565d8cddfb04577dca682bbea33687abeb98535 /app/src/main/java/com/zeapo/pwdstore/utils | |
| parent | 994cb0272b104d5288c0d3e8c59bbb7e162044e8 (diff) | |
| download | HardenedPass-62b4d78e93200ce46fa82dc00e0aa7a3083ff2f0.tar.gz HardenedPass-62b4d78e93200ce46fa82dc00e0aa7a3083ff2f0.zip | |
now possible to clone/create repository in a given external directory.
*issues*:
- not possible to switch between external/local directory without closing the app. (PasswordRepository is a singleton, has to be cleaned when a change is made)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/utils')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java index 6e7de7f1..9395fd68 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java @@ -5,8 +5,8 @@ import android.util.Log; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.FileFilterUtils; import org.eclipse.jgit.api.Git; -import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RemoteConfig; @@ -49,11 +49,7 @@ public class PasswordRepository { } public static boolean isInitialized() { - return initialized; - } - - public static void setInitialized(boolean v) { - initialized = v; + return repository != null; } public static void createRepository(File localDir) throws Exception{ @@ -112,6 +108,7 @@ public class PasswordRepository { public static void closeRepository() { repository.close(); + repository = null; } public static ArrayList<File> getFilesList(){ @@ -131,15 +128,6 @@ public class PasswordRepository { } /** - * Gets a file from the working tree - * @param name the relative path of the file - * @return the file in the repository - */ - public static File getFile(String name) { - return new File(repository.getWorkTree() + "/" + name); - } - - /** * Gets the .gpg files in a directory * @param path the directory path * @return the list of gpg files in that directory |
