From cfa420769addee0efa1b5b62b150ccfdd2e91ffe Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 12 Dec 2013 22:05:50 -0800 Subject: #220 Unpin old starred instead of deleting --- .../daneren2005/dsub/service/sync/StarredSyncAdapter.java | 11 ++++++++--- 1 file 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()); } } -- cgit v1.2.3