-->\r
<manifest package="eu.alefzero.owncloud"\r
android:versionCode="1"\r
- android:versionName="0.1.189B" xmlns:android="http://schemas.android.com/apk/res/android">\r
+ android:versionName="0.1.190B" xmlns:android="http://schemas.android.com/apk/res/android">\r
\r
<uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
<uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
import eu.alefzero.owncloud.db.ProviderMeta;
import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
+import eu.alefzero.owncloud.files.services.FileDownloader;
import android.accounts.Account;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
if (file.getStoragePath() == null) {
// try to find existing file and bind it with current account
- File sdCard = Environment.getExternalStorageDirectory();
- File f = new File(sdCard.getAbsolutePath() + "/owncloud/" + mAccount.name + file.getRemotePath());
+ File f = new File(FileDownloader.getSavePath(mAccount.name) + file.getRemotePath());
if (f.exists())
file.setStoragePath(f.getAbsolutePath());
}
import android.app.Service;\r
import android.content.ContentValues;\r
import android.content.Intent;\r
+import android.net.Uri;\r
import android.os.Environment;\r
import android.os.Handler;\r
import android.os.HandlerThread;\r
}\r
}\r
\r
- public static final String getSavePath() {\r
+ public static final String getSavePath(String accountName) {\r
File sdCard = Environment.getExternalStorageDirectory();\r
- return sdCard.getAbsolutePath() + "/owncloud/";\r
+ return sdCard.getAbsolutePath() + "/owncloud/" + Uri.encode(accountName, "@"); \r
+ // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B\r
}\r
\r
- public static final String getTemporalPath() {\r
+ public static final String getTemporalPath(String accountName) {\r
File sdCard = Environment.getExternalStorageDirectory();\r
- return sdCard.getAbsolutePath() + "/owncloud.tmp/";\r
+ return sdCard.getAbsolutePath() + "/owncloud/tmp/" + Uri.encode(accountName, "@");\r
+ // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B\r
}\r
\r
@Override\r
\r
\r
/// download will be in a temporal file\r
- File tmpFile = new File(getTemporalPath() + mAccount.name + mFilePath);\r
+ File tmpFile = new File(getTemporalPath(mAccount.name) + mFilePath);\r
\r
/// create status notification to show the download progress\r
mNotification = new Notification(R.drawable.icon, getString(R.string.downloader_download_in_progress_ticker), System.currentTimeMillis());\r
File newFile = null;\r
try {\r
if (wdc.downloadFile(mRemotePath, tmpFile)) {\r
- newFile = new File(getSavePath() + mAccount.name + mFilePath);\r
+ newFile = new File(getSavePath(mAccount.name) + mFilePath);\r
newFile.getParentFile().mkdirs();\r
boolean moved = tmpFile.renameTo(newFile);\r
\r
\r
import java.net.MalformedURLException;\r
import java.net.URL;\r
+import java.net.URLEncoder;\r
\r
import android.accounts.Account;\r
import android.accounts.AccountAuthenticatorActivity;\r
\r
String username = username_text.getText().toString().trim();\r
String accountName = username + "@" + url.getHost();\r
+ if (url.getPort() >= 0) {\r
+ accountName += ":" + url.getPort();\r
+ }\r
Account account = new Account(accountName,\r
AccountAuthenticator.ACCOUNT_TYPE);\r
AccountManager accManager = AccountManager.get(this);\r