diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-12-12 22:05:50 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-12-12 22:05:50 -0800 |
commit | cfa420769addee0efa1b5b62b150ccfdd2e91ffe (patch) | |
tree | c6d9ca1e855ec82d49323f60b22568ff581c4d56 | |
parent | d31ce581fcf1a708f57779dcb7ea28abe390e1ef (diff) | |
download | dsub-cfa420769addee0efa1b5b62b150ccfdd2e91ffe.tar.gz dsub-cfa420769addee0efa1b5b62b150ccfdd2e91ffe.tar.bz2 dsub-cfa420769addee0efa1b5b62b150ccfdd2e91ffe.zip |
#220 Unpin old starred instead of deleting
-rw-r--r-- | src/github/daneren2005/dsub/service/sync/StarredSyncAdapter.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/sync/StarredSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/StarredSyncAdapter.java index cc9db1f8..10ab58b6 100644 --- a/src/github/daneren2005/dsub/service/sync/StarredSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/StarredSyncAdapter.java @@ -63,9 +63,14 @@ public class StarredSyncAdapter extends SubsonicSyncAdapter { oldSyncedList.removeAll(syncedList);
for(String path: oldSyncedList) {
- File file = new File(path);
- if(!file.delete()) {
- Log.w(TAG, "Failed to delete " + path);
+ File saveFile = new File(path);
+
+ // Unpin file, rename to .complete
+ File completeFile = new File(saveFile.getParent(), FileUtil.getBaseName(saveFile.getName()) +
+ ".complete." + FileUtil.getExtension(saveFile.getName()));
+
+ if(!saveFile.renameTo(completeFile)) {
+ Log.w(TAG, "Failed to rename " + path + " to " + completeFile.getPath());
}
}
|