downloading files do account specific dir to avoid disambiguity
authorBartek Przybylski <bart.p.pl@gmail.com>
Sat, 26 May 2012 21:03:46 +0000 (23:03 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sat, 26 May 2012 21:03:46 +0000 (23:03 +0200)
src/eu/alefzero/owncloud/files/services/FileDownloader.java

index 087b103..a5ee28f 100644 (file)
@@ -1,6 +1,7 @@
 package eu.alefzero.owncloud.files.services;\r
 \r
 import java.io.File;\r
+import java.io.IOException;\r
 \r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
@@ -127,9 +128,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         mNotificationMngr.notify(1, mNotification);\r
 \r
         File sdCard = Environment.getExternalStorageDirectory();\r
-        File dir = new File(sdCard.getAbsolutePath() + "/owncloud");\r
-        dir.mkdirs();\r
-        File file = new File(dir, mFilePath.replace('/', '.'));\r
+        File file = new File(sdCard.getAbsolutePath() + "/owncloud/" + mAccount.name + mFilePath);\r
+        try {\r
+            file.createNewFile();\r
+        } catch (IOException e) {\r
+            e.printStackTrace();\r
+        }\r
 \r
         Log.e(TAG, file.getAbsolutePath() + " " + oc_url.toString());\r
         Log.e(TAG, mFilePath+"");\r