You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/03/31 19:58:10 UTC
[01/11] cordova-plugin-file git commit: CB-8689 Fix NPE in
makeEntryForNativeUri (was affecting file-transfer)
Repository: cordova-plugin-file
Updated Branches:
refs/heads/old-ID d57238b5b -> 44da98349
CB-8689 Fix NPE in makeEntryForNativeUri (was affecting file-transfer)
Regression was introduced in a recent commit and was never released.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/5b1afc28
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/5b1afc28
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/5b1afc28
Branch: refs/heads/old-ID
Commit: 5b1afc28123e8fbe2b09a278ca748914c22b3ca1
Parents: d57238b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 09:54:48 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 09:54:48 2015 -0400
----------------------------------------------------------------------
src/android/Filesystem.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/5b1afc28/src/android/Filesystem.java
----------------------------------------------------------------------
diff --git a/src/android/Filesystem.java b/src/android/Filesystem.java
index 46786f3..478f6f0 100644
--- a/src/android/Filesystem.java
+++ b/src/android/Filesystem.java
@@ -83,12 +83,12 @@ public abstract class Filesystem {
public JSONObject makeEntryForURL(LocalFilesystemURL inputURL) {
Uri nativeUri = toNativeUri(inputURL);
- return makeEntryForURL(inputURL, nativeUri);
+ return nativeUri == null ? null : makeEntryForURL(inputURL, nativeUri);
}
public JSONObject makeEntryForNativeUri(Uri nativeUri) {
LocalFilesystemURL inputUrl = toLocalUri(nativeUri);
- return makeEntryForURL(inputUrl, nativeUri);
+ return inputUrl == null ? null : makeEntryForURL(inputUrl, nativeUri);
}
public JSONObject getEntryForLocalURL(LocalFilesystemURL inputURL) throws IOException {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[09/11] cordova-plugin-file git commit: docs: added Windows to
supported platforms
Posted by st...@apache.org.
docs: added Windows to supported platforms
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/d9ed7d5a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d9ed7d5a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d9ed7d5a
Branch: refs/heads/old-ID
Commit: d9ed7d5a257e98c8d0aa69d07c534c1192a12439
Parents: 67924cf
Author: sgrebnov <v-...@microsoft.com>
Authored: Thu Mar 19 18:04:38 2015 +0300
Committer: sgrebnov <v-...@microsoft.com>
Committed: Thu Mar 19 18:04:38 2015 +0300
----------------------------------------------------------------------
README.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d9ed7d5a/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a0030bb..2ab7dd2 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@ Although in the global scope, it is not available until after the `deviceready`
- iOS
- Windows Phone 7 and 8*
- Windows 8*
+- Windows*
- Browser
\* _These platforms do not support `FileReader.readAsArrayBuffer` nor `FileWriter.write(blob)`._
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[10/11] cordova-plugin-file git commit: Use TRAVIS_BUILD_DIR,
install paramedic by npm
Posted by st...@apache.org.
Use TRAVIS_BUILD_DIR, install paramedic by npm
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/002be37c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/002be37c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/002be37c
Branch: refs/heads/old-ID
Commit: 002be37cf243de833712b48c9d2ee4f93dcb9d76
Parents: d9ed7d5
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Mar 24 23:55:49 2015 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Mar 24 23:55:49 2015 -0700
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/002be37c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 7ef5468..fa7ae7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,8 +6,8 @@ node_js:
install:
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- cd ..
- - npm install -g purplecabbage/cordova-paramedic
+ - npm install -g cordova-paramedic
- npm install -g cordova
- npm install -g ios-sim
script:
- - cordova-paramedic --platform ios --plugin ../cordova-plugin-file
\ No newline at end of file
+ - cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[11/11] cordova-plugin-file git commit: CB-8653 updated translated
docs to use new id
Posted by st...@apache.org.
CB-8653 updated translated docs to use new id
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/44da9834
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/44da9834
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/44da9834
Branch: refs/heads/old-ID
Commit: 44da98349a92f63467e498d028e0484d07884202
Parents: 002be37
Author: Steve Gill <st...@gmail.com>
Authored: Tue Mar 31 10:53:31 2015 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Mar 31 10:53:31 2015 -0700
----------------------------------------------------------------------
doc/de/index.md | 2 +-
doc/de/plugins.md | 2 +-
doc/es/index.md | 2 +-
doc/es/plugins.md | 2 +-
doc/fr/index.md | 2 +-
doc/fr/plugins.md | 2 +-
doc/it/index.md | 2 +-
doc/it/plugins.md | 2 +-
doc/ja/index.md | 2 +-
doc/ja/plugins.md | 2 +-
doc/ko/index.md | 2 +-
doc/ko/plugins.md | 2 +-
doc/pl/index.md | 2 +-
doc/pl/plugins.md | 2 +-
doc/ru/index.md | 2 +-
doc/ru/plugins.md | 2 +-
doc/zh/index.md | 2 +-
doc/zh/plugins.md | 2 +-
18 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/de/index.md
----------------------------------------------------------------------
diff --git a/doc/de/index.md b/doc/de/index.md
index 2797d40..5755807 100644
--- a/doc/de/index.md
+++ b/doc/de/index.md
@@ -335,4 +335,4 @@ Android unterstützt auch eine spezielle Dateisystem mit dem Namen "documents",
* `bundle`: die Anwendung Bündel; den Speicherort der die app selbst auf dem Datenträger (schreibgeschützt)
* `root`: das gesamte Gerät-Dateisystem
-Standardmäßig können die Bibliothek und Dokumenten-Verzeichnisse mit iCloud synchronisiert werden. Sie können auch verlangen, zwei zusätzliche Dateisysteme, `library-nosync` und `documents-nosync`, die einem speziellen nicht synchronisierten Verzeichnis innerhalb darstellen der `/Library` oder `/Documents`-Dateisystem.
\ No newline at end of file
+Standardmäßig können die Bibliothek und Dokumenten-Verzeichnisse mit iCloud synchronisiert werden. Sie können auch verlangen, zwei zusätzliche Dateisysteme, `library-nosync` und `documents-nosync`, die einem speziellen nicht synchronisierten Verzeichnis innerhalb darstellen der `/Library` oder `/Documents`-Dateisystem.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/de/plugins.md
----------------------------------------------------------------------
diff --git a/doc/de/plugins.md b/doc/de/plugins.md
index 1f4297f..2286133 100644
--- a/doc/de/plugins.md
+++ b/doc/de/plugins.md
@@ -121,4 +121,4 @@ Im Plugin Antwort Handler um aus einer zurückgegebenen FileEntries-Struktur in
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/es/index.md
----------------------------------------------------------------------
diff --git a/doc/es/index.md b/doc/es/index.md
index c76940f..62dd900 100644
--- a/doc/es/index.md
+++ b/doc/es/index.md
@@ -333,4 +333,4 @@ Android también es compatible con un sistema de archivos especial llamado "docu
* `bundle`: paquete de la aplicación; la ubicación de la aplicación en sí mismo en el disco (sólo lectura)
* `root`: el sistema de archivos de todo el dispositivo
-De forma predeterminada, los directorios de documentos y la biblioteca pueden ser sincronizados con iCloud. También puede solicitar dos sistemas adicionales, `library-nosync` y `documents-nosync`, que representan un directorio especial no sincronizados dentro de la `/Library` o sistema de ficheros `/Documents`.
\ No newline at end of file
+De forma predeterminada, los directorios de documentos y la biblioteca pueden ser sincronizados con iCloud. También puede solicitar dos sistemas adicionales, `library-nosync` y `documents-nosync`, que representan un directorio especial no sincronizados dentro de la `/Library` o sistema de ficheros `/Documents`.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/es/plugins.md
----------------------------------------------------------------------
diff --git a/doc/es/plugins.md b/doc/es/plugins.md
index fd126fc..49a1d99 100644
--- a/doc/es/plugins.md
+++ b/doc/es/plugins.md
@@ -121,4 +121,4 @@ En plugin manipuladores de respuesta, para convertir de una estructura FileEntry
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/fr/index.md
----------------------------------------------------------------------
diff --git a/doc/fr/index.md b/doc/fr/index.md
index afe2fc4..b2f0fee 100644
--- a/doc/fr/index.md
+++ b/doc/fr/index.md
@@ -328,4 +328,4 @@ Android prend également en charge un système de fichiers spécial nommé « do
* `bundle` : bundle de l'application ; l'emplacement de l'application elle-même sur disque (lecture seule)
* `root` : le système de fichiers de tout dispositif
-Par défaut, vous peuvent synchroniser les répertoires de la bibliothèque et les documents à iCloud. Vous pouvez également demander des deux systèmes de fichiers supplémentaires, `library-nosync` et `documents-nosync`, qui représentent un répertoire spécial non synchronisées dans le `/Library` ou système de fichiers `/ Documents`.
\ No newline at end of file
+Par défaut, vous peuvent synchroniser les répertoires de la bibliothèque et les documents à iCloud. Vous pouvez également demander des deux systèmes de fichiers supplémentaires, `library-nosync` et `documents-nosync`, qui représentent un répertoire spécial non synchronisées dans le `/Library` ou système de fichiers `/ Documents`.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/fr/plugins.md
----------------------------------------------------------------------
diff --git a/doc/fr/plugins.md b/doc/fr/plugins.md
index 070384e..efd1bac 100644
--- a/doc/fr/plugins.md
+++ b/doc/fr/plugins.md
@@ -121,4 +121,4 @@ Dans gestionnaires de plugin de réponse, pour convertir une structure FileEntry
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/it/index.md
----------------------------------------------------------------------
diff --git a/doc/it/index.md b/doc/it/index.md
index 572fcf5..14d0a83 100644
--- a/doc/it/index.md
+++ b/doc/it/index.md
@@ -335,4 +335,4 @@ Android supporta anche un filesystem speciale denominato "documenti", che rappre
* `bundle`: bundle dell'applicazione; la posizione dell'app sul disco (sola lettura)
* `root`: il dispositivo intero filesystem
-Per impostazione predefinita, la directory di libreria e documenti può essere sincronizzata a iCloud. È anche possibile richiedere due filesystem aggiuntivi, `library-nosync` e `documents-nosync`, che rappresentano una speciale directory non sincronizzati entro il `/Library` o filesystem `/Documents`.
\ No newline at end of file
+Per impostazione predefinita, la directory di libreria e documenti può essere sincronizzata a iCloud. È anche possibile richiedere due filesystem aggiuntivi, `library-nosync` e `documents-nosync`, che rappresentano una speciale directory non sincronizzati entro il `/Library` o filesystem `/Documents`.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/it/plugins.md
----------------------------------------------------------------------
diff --git a/doc/it/plugins.md b/doc/it/plugins.md
index c02ca2f..a66ab8e 100644
--- a/doc/it/plugins.md
+++ b/doc/it/plugins.md
@@ -121,4 +121,4 @@ Nei gestori di risposta plugin, per convertire da una struttura FileEntry restit
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ja/index.md
----------------------------------------------------------------------
diff --git a/doc/ja/index.md b/doc/ja/index.md
index 8244cc9..78758ea 100644
--- a/doc/ja/index.md
+++ b/doc/ja/index.md
@@ -335,4 +335,4 @@ V1.1.0 の `toURL()` の戻り値に変更されました (\[CB-6394\] (https://
* `bundle`: アプリケーションバンドル;アプリ自体 (読み取りのみ) ディスク上の場所
* `root`: デバイス全体のファイルシステム
-既定では、ライブラリとドキュメント ディレクトリを iCloud に同期できます。 2 つの追加のファイルシステム、`library-nosync` および `documents-nosync` を表す、特別な非同期ディレクトリ内を要求することもできます、`/Library` または `Documents/` ファイルシステム。
\ No newline at end of file
+既定では、ライブラリとドキュメント ディレクトリを iCloud に同期できます。 2 つの追加のファイルシステム、`library-nosync` および `documents-nosync` を表す、特別な非同期ディレクトリ内を要求することもできます、`/Library` または `Documents/` ファイルシステム。
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ja/plugins.md
----------------------------------------------------------------------
diff --git a/doc/ja/plugins.md b/doc/ja/plugins.md
index 3dedb28..ed973e9 100644
--- a/doc/ja/plugins.md
+++ b/doc/ja/plugins.md
@@ -121,4 +121,4 @@ Java スクリプトの設定を取得するには `cdvfile://` 認証または
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ko/index.md
----------------------------------------------------------------------
diff --git a/doc/ko/index.md b/doc/ko/index.md
index dde8991..e4763a3 100644
--- a/doc/ko/index.md
+++ b/doc/ko/index.md
@@ -335,4 +335,4 @@ V1.1.0에 `toURL()`의 반환 값 (\[CB-6394\] (https://issues.apache.org/jira/b
* `bundle`: 응용 프로그램의 번들; (읽기 전용) 디스크에 응용 프로그램 자체의 위치
* `root`: 전체 장치 파일 시스템
-기본적으로 라이브러리 및 문서 디렉토리 iCloud에 동기화 할 수 있습니다. 또한 2 개의 추가적인 파일 시스템, `library-nosync` 및 `documents-nosync`, 내 특별 한 동기화 되지 않은 디렉터리를 대표 하는 요청할 수 있습니다는 `/Library` 또는 `/Documents` 파일 시스템.
\ No newline at end of file
+기본적으로 라이브러리 및 문서 디렉토리 iCloud에 동기화 할 수 있습니다. 또한 2 개의 추가적인 파일 시스템, `library-nosync` 및 `documents-nosync`, 내 특별 한 동기화 되지 않은 디렉터리를 대표 하는 요청할 수 있습니다는 `/Library` 또는 `/Documents` 파일 시스템.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ko/plugins.md
----------------------------------------------------------------------
diff --git a/doc/ko/plugins.md b/doc/ko/plugins.md
index d5ec121..47c4fe0 100644
--- a/doc/ko/plugins.md
+++ b/doc/ko/plugins.md
@@ -121,4 +121,4 @@ IOS에서 코르도바 같은 사용 하지 않는 `CordovaResourceApi` 안 드
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/pl/index.md
----------------------------------------------------------------------
diff --git a/doc/pl/index.md b/doc/pl/index.md
index 74eba45..24348a7 100644
--- a/doc/pl/index.md
+++ b/doc/pl/index.md
@@ -335,4 +335,4 @@ Android obsługuje również specjalnych plików o nazwie "dokumenty", który re
* `bundle`: pakiet aplikacji; Lokalizacja aplikacji na dysku (tylko do odczytu)
* `root`: całe urządzenie systemu plików
-Domyślnie katalogi biblioteki i dokumenty mogą być synchronizowane iCloud. Można również zażądać dwóch dodatkowych plików, `library-nosync` i `documents-nosync`, które stanowią specjalny katalog nie zsynchronizowane w `/Library` lub systemu plików `/Documents`.
\ No newline at end of file
+Domyślnie katalogi biblioteki i dokumenty mogą być synchronizowane iCloud. Można również zażądać dwóch dodatkowych plików, `library-nosync` i `documents-nosync`, które stanowią specjalny katalog nie zsynchronizowane w `/Library` lub systemu plików `/Documents`.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/pl/plugins.md
----------------------------------------------------------------------
diff --git a/doc/pl/plugins.md b/doc/pl/plugins.md
index a1f9169..bfc26b6 100644
--- a/doc/pl/plugins.md
+++ b/doc/pl/plugins.md
@@ -121,4 +121,4 @@ W plugin obsługi odpowiedzi do przeliczenia strukturę FileEntry wrócił do rz
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ru/index.md
----------------------------------------------------------------------
diff --git a/doc/ru/index.md b/doc/ru/index.md
index 2a23e69..70ab60b 100644
--- a/doc/ru/index.md
+++ b/doc/ru/index.md
@@ -272,4 +272,4 @@ Android поддерживает также Специальный файлов
* `bundle`: Пакет приложения; расположение самого приложения на диске (только для чтения)
* `root`: Все устройство файловой системы
-По умолчанию каталоги библиотеки и документы можно синхронизировать с iCloud. Вы также можете заказать два дополнительных файловых систем, `library-nosync` и `documents-nosync` , которые представляют Специальный каталог не синхронизируются в `/Library` или `/Documents` файловой системы.
\ No newline at end of file
+По умолчанию каталоги библиотеки и документы можно синхронизировать с iCloud. Вы также можете заказать два дополнительных файловых систем, `library-nosync` и `documents-nosync` , которые представляют Специальный каталог не синхронизируются в `/Library` или `/Documents` файловой системы.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/ru/plugins.md
----------------------------------------------------------------------
diff --git a/doc/ru/plugins.md b/doc/ru/plugins.md
index b9a637a..312e663 100644
--- a/doc/ru/plugins.md
+++ b/doc/ru/plugins.md
@@ -121,4 +121,4 @@
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/zh/index.md
----------------------------------------------------------------------
diff --git a/doc/zh/index.md b/doc/zh/index.md
index 59dc7f9..cab37a6 100644
--- a/doc/zh/index.md
+++ b/doc/zh/index.md
@@ -340,4 +340,4 @@
* `bundle`: 應用程式的包 ;應用程式本身 (唯讀) 的磁片上的位置
* `root`: 整個設備的檔案系統
-預設情況下,圖書館和檔目錄可以同步到 iCloud。 您也可以要求兩個額外的檔案系統、 `library-nosync` 和 `documents-nosync`,代表一個特殊的非同步目錄內 `/Library` 或 `/Documents` 的檔案系統。
\ No newline at end of file
+預設情況下,圖書館和檔目錄可以同步到 iCloud。 您也可以要求兩個額外的檔案系統、 `library-nosync` 和 `documents-nosync`,代表一個特殊的非同步目錄內 `/Library` 或 `/Documents` 的檔案系統。
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/44da9834/doc/zh/plugins.md
----------------------------------------------------------------------
diff --git a/doc/zh/plugins.md b/doc/zh/plugins.md
index 462fb06..94c7254 100644
--- a/doc/zh/plugins.md
+++ b/doc/zh/plugins.md
@@ -121,4 +121,4 @@
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
} else {
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
- }
\ No newline at end of file
+ }
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[03/11] cordova-plugin-file git commit: CB-8695 ios: Fix
`blob.slice()` for `asset-library` URLs (close #105)
Posted by st...@apache.org.
CB-8695 ios: Fix `blob.slice()` for `asset-library` URLs (close #105)
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/2d12a2e2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2d12a2e2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2d12a2e2
Branch: refs/heads/old-ID
Commit: 2d12a2e2f793c3f23065f4a2bbe042f373462114
Parents: 6e91934
Author: Brad Chen <br...@hotmail.com>
Authored: Tue Mar 17 11:53:25 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 12:58:21 2015 -0400
----------------------------------------------------------------------
src/ios/CDVAssetLibraryFilesystem.m | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2d12a2e2/src/ios/CDVAssetLibraryFilesystem.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVAssetLibraryFilesystem.m b/src/ios/CDVAssetLibraryFilesystem.m
index 5e3a20d..0b95fac 100644
--- a/src/ios/CDVAssetLibraryFilesystem.m
+++ b/src/ios/CDVAssetLibraryFilesystem.m
@@ -194,8 +194,9 @@ NSString* const kCDVAssetsLibraryScheme = @"assets-library";
if (asset) {
// We have the asset! Get the data and send it off.
ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation];
- Byte* buffer = (Byte*)malloc([assetRepresentation size]);
- NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:[assetRepresentation size] error:nil];
+ NSUInteger size = (end > start) ? (end - start) : [assetRepresentation size];
+ Byte* buffer = (Byte*)malloc(size);
+ NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:start length:size error:nil];
NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES];
NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[06/11] cordova-plugin-file git commit: android: Move URLforFullPath
into base class (and rename to localUrlforFullPath)
Posted by st...@apache.org.
android: Move URLforFullPath into base class (and rename to localUrlforFullPath)
Was identical in subclasses
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/2ce5c498
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2ce5c498
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2ce5c498
Branch: refs/heads/old-ID
Commit: 2ce5c498f0a6caf64092ba001842cd0161ebefcb
Parents: a47709e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 20:56:58 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 20:56:58 2015 -0400
----------------------------------------------------------------------
src/android/AssetFilesystem.java | 15 +++------------
src/android/Filesystem.java | 8 ++++++++
src/android/LocalFilesystem.java | 14 +++-----------
3 files changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/AssetFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/AssetFilesystem.java b/src/android/AssetFilesystem.java
index 525d188..934a237 100644
--- a/src/android/AssetFilesystem.java
+++ b/src/android/AssetFilesystem.java
@@ -132,15 +132,6 @@ public class AssetFilesystem extends Filesystem {
}
}
- private LocalFilesystemURL URLforFullPath(String fullPath) {
- Uri nativeUri = nativeUriForFullPath(fullPath);
- if (nativeUri != null) {
- return toLocalUri(nativeUri);
- }
- return null;
- }
-
-
@Override
public LocalFilesystemURL[] listChildren(LocalFilesystemURL inputURL) throws FileNotFoundException {
String pathNoSlashes = inputURL.path.substring(1);
@@ -157,7 +148,7 @@ public class AssetFilesystem extends Filesystem {
LocalFilesystemURL[] entries = new LocalFilesystemURL[files.length];
for (int i = 0; i < files.length; ++i) {
- entries[i] = URLforFullPath(new File(inputURL.path, files[i]).getPath());
+ entries[i] = localUrlforFullPath(new File(inputURL.path, files[i]).getPath());
}
return entries;
}
@@ -177,9 +168,9 @@ public class AssetFilesystem extends Filesystem {
LocalFilesystemURL requestedURL;
if (path.startsWith("/")) {
- requestedURL = URLforFullPath(normalizePath(path));
+ requestedURL = localUrlforFullPath(normalizePath(path));
} else {
- requestedURL = URLforFullPath(normalizePath(inputURL.path + "/" + path));
+ requestedURL = localUrlforFullPath(normalizePath(inputURL.path + "/" + path));
}
// Throws a FileNotFoundException if it doesn't exist.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/Filesystem.java
----------------------------------------------------------------------
diff --git a/src/android/Filesystem.java b/src/android/Filesystem.java
index 478f6f0..faf31d2 100644
--- a/src/android/Filesystem.java
+++ b/src/android/Filesystem.java
@@ -146,6 +146,14 @@ public abstract class Filesystem {
return ret;
}
+ public LocalFilesystemURL localUrlforFullPath(String fullPath) {
+ Uri nativeUri = nativeUriForFullPath(fullPath);
+ if (nativeUri != null) {
+ return toLocalUri(nativeUri);
+ }
+ return null;
+ }
+
/**
* Removes multiple repeated //s, and collapses processes ../s.
*/
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index 355cccf..258b957 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -60,14 +60,6 @@ public class LocalFilesystem extends Filesystem {
return null;
}
- protected LocalFilesystemURL URLforFullPath(String fullPath) {
- Uri nativeUri = nativeUriForFullPath(fullPath);
- if (nativeUri != null) {
- return toLocalUri(nativeUri);
- }
- return null;
- }
-
@Override
public Uri toNativeUri(LocalFilesystemURL inputURL) {
return nativeUriForFullPath(inputURL.path);
@@ -107,7 +99,7 @@ public class LocalFilesystem extends Filesystem {
@Override
public LocalFilesystemURL URLforFilesystemPath(String path) {
- return this.URLforFullPath(this.fullPathForFilesystemPath(path));
+ return localUrlforFullPath(fullPathForFilesystemPath(path));
}
@Override
@@ -135,9 +127,9 @@ public class LocalFilesystem extends Filesystem {
path += "/";
}
if (path.startsWith("/")) {
- requestedURL = URLforFullPath(normalizePath(path));
+ requestedURL = localUrlforFullPath(normalizePath(path));
} else {
- requestedURL = URLforFullPath(normalizePath(inputURL.path + "/" + path));
+ requestedURL = localUrlforFullPath(normalizePath(inputURL.path + "/" + path));
}
File fp = new File(this.filesystemPathForURL(requestedURL));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[05/11] cordova-plugin-file git commit: CB-6428 Mention
build-extras.gradle in README
Posted by st...@apache.org.
CB-6428 Mention build-extras.gradle in README
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/a47709e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/a47709e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/a47709e5
Branch: refs/heads/old-ID
Commit: a47709e53844d0b690d0f18b5ebc2e3649d840e4
Parents: 7a84979
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 13:09:40 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 13:09:40 2015 -0400
----------------------------------------------------------------------
README.md | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/a47709e5/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index ed71b9e..a0030bb 100644
--- a/README.md
+++ b/README.md
@@ -228,6 +228,11 @@ unable to access their previously-stored files, depending on their device.
If your application is new, or has never previously stored files in the
persistent filesystem, then the `Internal` setting is generally recommended.
+### Slow recursive operations for /android_asset
+
+Listing asset directories is really slow on Android. You can speed it up though, by
+adding `src/android/build-extras.gradle` to the root of your android project (also
+requires cordova-android@4.0.0 or greater).
## iOS Quirks
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[04/11] cordova-plugin-file git commit: CB-7109 android: Parse
arguments off of the main thread (close #97)
Posted by st...@apache.org.
CB-7109 android: Parse arguments off of the main thread (close #97)
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/7a849795
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/7a849795
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/7a849795
Branch: refs/heads/old-ID
Commit: 7a849795e139c2af770986f5672b7a291ce84752
Parents: 2d12a2e
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Jan 5 14:52:40 2015 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 13:05:54 2015 -0400
----------------------------------------------------------------------
src/android/FileUtils.java | 195 ++++++++++++++++++++--------------------
1 file changed, 95 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/7a849795/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index ba096ad..a803d15 100644
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -73,7 +73,7 @@ public class FileUtils extends CordovaPlugin {
private static FileUtils filePlugin;
private interface FileOp {
- void run( ) throws Exception;
+ void run(JSONArray args) throws Exception;
}
private ArrayList<Filesystem> filesystems;
@@ -241,122 +241,114 @@ public class FileUtils extends CordovaPlugin {
}
}
- /**
- * Executes the request and returns whether the action was valid.
- *
- * @param action The action to execute.
- * @param args JSONArray of arguments for the plugin.
- * @param callbackContext The callback context used when calling back into JavaScript.
- * @return True if the action was valid, false otherwise.
- */
- public boolean execute(String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException {
+ public boolean execute(String action, final String rawArgs, final CallbackContext callbackContext) {
if (!configured) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "File plugin is not configured. Please see the README.md file for details on how to update config.xml"));
return true;
}
if (action.equals("testSaveLocationExists")) {
threadhelper( new FileOp( ){
- public void run() {
+ public void run(JSONArray args) {
boolean b = DirectoryManager.testSaveLocationExists();
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("getFreeDiskSpace")) {
threadhelper( new FileOp( ){
- public void run() {
+ public void run(JSONArray args) {
long l = DirectoryManager.getFreeDiskSpace(false);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("testFileExists")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() {
+ public void run(JSONArray args) throws JSONException {
+ String fname=args.getString(0);
boolean b = DirectoryManager.testFileExists(fname);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("testDirectoryExists")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() {
+ public void run(JSONArray args) throws JSONException {
+ String fname=args.getString(0);
boolean b = DirectoryManager.testFileExists(fname);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("readAsText")) {
- final String encoding = args.getString(1);
- final int start = args.getInt(2);
- final int end = args.getInt(3);
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws MalformedURLException {
+ public void run(JSONArray args) throws JSONException, MalformedURLException {
+ String encoding = args.getString(1);
+ int start = args.getInt(2);
+ int end = args.getInt(3);
+ String fname=args.getString(0);
readFileAs(fname, start, end, callbackContext, encoding, PluginResult.MESSAGE_TYPE_STRING);
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("readAsDataURL")) {
- final int start = args.getInt(1);
- final int end = args.getInt(2);
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws MalformedURLException {
+ public void run(JSONArray args) throws JSONException, MalformedURLException {
+ int start = args.getInt(1);
+ int end = args.getInt(2);
+ String fname=args.getString(0);
readFileAs(fname, start, end, callbackContext, null, -1);
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("readAsArrayBuffer")) {
- final int start = args.getInt(1);
- final int end = args.getInt(2);
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws MalformedURLException {
+ public void run(JSONArray args) throws JSONException, MalformedURLException {
+ int start = args.getInt(1);
+ int end = args.getInt(2);
+ String fname=args.getString(0);
readFileAs(fname, start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_ARRAYBUFFER);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("readAsBinaryString")) {
- final int start = args.getInt(1);
- final int end = args.getInt(2);
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws MalformedURLException {
+ public void run(JSONArray args) throws JSONException, MalformedURLException {
+ int start = args.getInt(1);
+ int end = args.getInt(2);
+ String fname=args.getString(0);
readFileAs(fname, start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_BINARYSTRING);
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("write")) {
- final String fname=args.getString(0);
- final String data=args.getString(1);
- final int offset=args.getInt(2);
- final Boolean isBinary=args.getBoolean(3);
threadhelper( new FileOp( ){
- public void run() throws FileNotFoundException, IOException, NoModificationAllowedException {
+ public void run(JSONArray args) throws JSONException, FileNotFoundException, IOException, NoModificationAllowedException {
+ String fname=args.getString(0);
+ String data=args.getString(1);
+ int offset=args.getInt(2);
+ Boolean isBinary=args.getBoolean(3);
long fileSize = write(fname, data, offset, isBinary);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize));
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("truncate")) {
- final String fname=args.getString(0);
- final int offset=args.getInt(1);
threadhelper( new FileOp( ){
- public void run( ) throws FileNotFoundException, IOException, NoModificationAllowedException {
+ public void run(JSONArray args) throws JSONException, FileNotFoundException, IOException, NoModificationAllowedException {
+ String fname=args.getString(0);
+ int offset=args.getInt(1);
long fileSize = truncateFile(fname, offset);
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize));
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("requestAllFileSystems")) {
threadhelper( new FileOp( ){
- public void run() throws IOException, JSONException {
+ public void run(JSONArray args) throws IOException, JSONException {
callbackContext.success(requestAllFileSystems());
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
} else if (action.equals("requestAllPaths")) {
cordova.getThreadPool().execute(
new Runnable() {
@@ -371,10 +363,10 @@ public class FileUtils extends CordovaPlugin {
}
);
} else if (action.equals("requestFileSystem")) {
- final int fstype=args.getInt(0);
- final long size = args.optLong(1);
threadhelper( new FileOp( ){
- public void run() throws IOException, JSONException {
+ public void run(JSONArray args) throws IOException, JSONException {
+ int fstype=args.getInt(0);
+ long size = args.optLong(1);
if (size != 0 && size > (DirectoryManager.getFreeDiskSpace(true) * 1024)) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, FileUtils.QUOTA_EXCEEDED_ERR));
} else {
@@ -382,59 +374,59 @@ public class FileUtils extends CordovaPlugin {
callbackContext.success(obj);
}
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("resolveLocalFileSystemURI")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws IOException, JSONException {
+ public void run(JSONArray args) throws IOException, JSONException {
+ String fname=args.getString(0);
JSONObject obj = resolveLocalFileSystemURI(fname);
callbackContext.success(obj);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("getFileMetadata")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws FileNotFoundException, JSONException, MalformedURLException {
+ public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException {
+ String fname=args.getString(0);
JSONObject obj = getFileMetadata(fname);
callbackContext.success(obj);
}
- }, callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("getParent")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws JSONException, IOException {
+ public void run(JSONArray args) throws JSONException, IOException {
+ String fname=args.getString(0);
JSONObject obj = getParent(fname);
callbackContext.success(obj);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("getDirectory")) {
- final String dirname=args.getString(0);
- final String path=args.getString(1);
threadhelper( new FileOp( ){
- public void run() throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
- JSONObject obj = getFile(dirname, path, args.optJSONObject(2), true);
- callbackContext.success(obj);
+ public void run(JSONArray args) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
+ String dirname=args.getString(0);
+ String path=args.getString(1);
+ JSONObject obj = getFile(dirname, path, args.optJSONObject(2), true);
+ callbackContext.success(obj);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("getFile")) {
- final String dirname=args.getString(0);
- final String path=args.getString(1);
threadhelper( new FileOp( ){
- public void run() throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
+ public void run(JSONArray args) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
+ String dirname=args.getString(0);
+ String path=args.getString(1);
JSONObject obj = getFile(dirname, path, args.optJSONObject(2), false);
callbackContext.success(obj);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("remove")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws NoModificationAllowedException, InvalidModificationException, MalformedURLException {
+ public void run(JSONArray args) throws JSONException, NoModificationAllowedException, InvalidModificationException, MalformedURLException {
+ String fname=args.getString(0);
boolean success = remove(fname);
if (success) {
callbackContext.success();
@@ -442,12 +434,12 @@ public class FileUtils extends CordovaPlugin {
callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR);
}
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("removeRecursively")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws FileExistsException, MalformedURLException, NoModificationAllowedException {
+ public void run(JSONArray args) throws JSONException, FileExistsException, MalformedURLException, NoModificationAllowedException {
+ String fname=args.getString(0);
boolean success = removeRecursively(fname);
if (success) {
callbackContext.success();
@@ -455,49 +447,49 @@ public class FileUtils extends CordovaPlugin {
callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR);
}
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("moveTo")) {
- final String fname=args.getString(0);
- final String newParent=args.getString(1);
- final String newName=args.getString(2);
threadhelper( new FileOp( ){
- public void run() throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException {
+ public void run(JSONArray args) throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException {
+ String fname=args.getString(0);
+ String newParent=args.getString(1);
+ String newName=args.getString(2);
JSONObject entry = transferTo(fname, newParent, newName, true);
callbackContext.success(entry);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("copyTo")) {
- final String fname=args.getString(0);
- final String newParent=args.getString(1);
- final String newName=args.getString(2);
threadhelper( new FileOp( ){
- public void run() throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException {
+ public void run(JSONArray args) throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException {
+ String fname=args.getString(0);
+ String newParent=args.getString(1);
+ String newName=args.getString(2);
JSONObject entry = transferTo(fname, newParent, newName, false);
callbackContext.success(entry);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("readEntries")) {
- final String fname=args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws FileNotFoundException, JSONException, MalformedURLException {
+ public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException {
+ String fname=args.getString(0);
JSONArray entries = readEntries(fname);
callbackContext.success(entries);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else if (action.equals("_getLocalFilesystemPath")) {
// Internal method for testing: Get the on-disk location of a local filesystem url.
// [Currently used for testing file-transfer]
- final String localURLstr = args.getString(0);
threadhelper( new FileOp( ){
- public void run() throws FileNotFoundException, JSONException, MalformedURLException {
+ public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException {
+ String localURLstr = args.getString(0);
String fname = filesystemPathForURL(localURLstr);
callbackContext.success(fname);
}
- },callbackContext);
+ }, rawArgs, callbackContext);
}
else {
return false;
@@ -566,11 +558,12 @@ public class FileUtils extends CordovaPlugin {
/* helper to execute functions async and handle the result codes
*
*/
- private void threadhelper(final FileOp f, final CallbackContext callbackContext){
+ private void threadhelper(final FileOp f, final String rawArgs, final CallbackContext callbackContext){
cordova.getThreadPool().execute(new Runnable() {
public void run() {
try {
- f.run();
+ JSONArray args = new JSONArray(rawArgs);
+ f.run(args);
} catch ( Exception e) {
if( e instanceof EncodingException){
callbackContext.error(FileUtils.ENCODING_ERR);
@@ -590,6 +583,8 @@ public class FileUtils extends CordovaPlugin {
callbackContext.error(FileUtils.ENCODING_ERR);
} else if(e instanceof TypeMismatchException ) {
callbackContext.error(FileUtils.TYPE_MISMATCH_ERR);
+ } else if(e instanceof JSONException ) {
+ callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
} else {
e.printStackTrace();
callbackContext.error(FileUtils.UNKNOWN_ERR);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[08/11] cordova-plugin-file git commit: CB-8699 CB-6428 Fix
uncompressed assets being copied as zero length files
Posted by st...@apache.org.
CB-8699 CB-6428 Fix uncompressed assets being copied as zero length files
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/67924cf9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/67924cf9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/67924cf9
Branch: refs/heads/old-ID
Commit: 67924cf9f679d3e6cbb05411f76f90405f36288c
Parents: ed4cb4b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 21:40:01 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 21:40:01 2015 -0400
----------------------------------------------------------------------
src/android/LocalFilesystem.java | 45 ++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/67924cf9/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index 258b957..7f5431c 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -20,9 +20,12 @@ package org.apache.cordova.file;
import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import org.apache.cordova.CordovaResourceApi;
@@ -262,7 +265,7 @@ public class LocalFilesystem extends Filesystem {
}
CordovaResourceApi.OpenForReadResult offr = resourceApi.openForRead(srcFs.toNativeUri(srcURL));
- resourceApi.copyResource(offr, new FileOutputStream(destFile));
+ copyResource(offr, new FileOutputStream(destFile));
if (move) {
srcFs.removeFileAtLocalURL(srcURL);
@@ -458,4 +461,44 @@ public class LocalFilesystem extends Filesystem {
File file = new File(path);
return file.exists();
}
+
+ // This is a copy & paste from CordovaResource API that is required since CordovaResourceApi
+ // has a bug pre-4.0.0.
+ // TODO: Once cordova-android@4.0.0 is released, delete this copy and make the plugin depend on
+ // 4.0.0 with an engine tag.
+ private static void copyResource(CordovaResourceApi.OpenForReadResult input, OutputStream outputStream) throws IOException {
+ try {
+ InputStream inputStream = input.inputStream;
+ if (inputStream instanceof FileInputStream && outputStream instanceof FileOutputStream) {
+ FileChannel inChannel = ((FileInputStream)input.inputStream).getChannel();
+ FileChannel outChannel = ((FileOutputStream)outputStream).getChannel();
+ long offset = 0;
+ long length = input.length;
+ if (input.assetFd != null) {
+ offset = input.assetFd.getStartOffset();
+ }
+ // transferFrom()'s 2nd arg is a relative position. Need to set the absolute
+ // position first.
+ inChannel.position(offset);
+ outChannel.transferFrom(inChannel, 0, length);
+ } else {
+ final int BUFFER_SIZE = 8192;
+ byte[] buffer = new byte[BUFFER_SIZE];
+
+ for (;;) {
+ int bytesRead = inputStream.read(buffer, 0, BUFFER_SIZE);
+
+ if (bytesRead <= 0) {
+ break;
+ }
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ }
+ } finally {
+ input.inputStream.close();
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[02/11] cordova-plugin-file git commit: Tweak build-extras.gradle to
just read/write to main `assets/` instead of `build/`
Posted by st...@apache.org.
Tweak build-extras.gradle to just read/write to main `assets/` instead of `build/`
Gave up on trying to figure out how to make it work correctly within
build/
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/6e919341
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/6e919341
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/6e919341
Branch: refs/heads/old-ID
Commit: 6e9193418cfe91b74222bcc1c421ea1f4bba327a
Parents: 5b1afc2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 09:56:15 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 09:56:15 2015 -0400
----------------------------------------------------------------------
src/android/build-extras.gradle | 44 ++++++++++++++++--------------------
1 file changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/6e919341/src/android/build-extras.gradle
----------------------------------------------------------------------
diff --git a/src/android/build-extras.gradle b/src/android/build-extras.gradle
index cf4ad92..86d91a6 100644
--- a/src/android/build-extras.gradle
+++ b/src/android/build-extras.gradle
@@ -17,34 +17,30 @@
under the License.
*/
ext.postBuildExtras = {
- android.applicationVariants.all { variant ->
- def variantName = variant.name.capitalize()
- def processResourcesTask = tasks["process${variantName}Resources"]
- def inAssetsDir = variant.mergeAssets.rawInputFolders.iterator().next()
- def outAssetsDir = inAssetsDir
- def outFile = new File(outAssetsDir, "cdvasset.manifest")
+ def inAssetsDir = file("assets")
+ def outAssetsDir = inAssetsDir
+ def outFile = new File(outAssetsDir, "cdvasset.manifest")
- def newTask = task("cdvCreateAssetManifest$variantName") << {
- println("Reading from ${inAssetsDir}")
- println("Writing to ${outFile}")
+ def newTask = task("cdvCreateAssetManifest") << {
+ println("Reading from ${inAssetsDir}")
+ println("Writing to ${outFile}")
- def contents = new HashMap()
- contents[""] = inAssetsDir.list()
- def tree = fileTree(dir: inAssetsDir)
- tree.visit { fileDetails ->
- if (fileDetails.isDirectory()) {
- contents[fileDetails.relativePath.toString()] = fileDetails.file.list()
- }
+ def contents = new HashMap()
+ contents[""] = inAssetsDir.list()
+ def tree = fileTree(dir: inAssetsDir)
+ tree.visit { fileDetails ->
+ if (fileDetails.isDirectory()) {
+ contents[fileDetails.relativePath.toString()] = fileDetails.file.list()
}
+ }
- outAssetsDir.mkdirs()
- outFile.withObjectOutputStream { oos ->
- oos.writeObject(contents)
- }
+ outAssetsDir.mkdirs()
+ outFile.withObjectOutputStream { oos ->
+ oos.writeObject(contents)
}
- newTask.dependsOn(tasks["prepare${variantName}Dependencies"])
- newTask.inputs.dir inAssetsDir
- newTask.outputs.file outFile
- processResourcesTask.dependsOn(newTask)
}
+ newTask.inputs.dir inAssetsDir
+ newTask.outputs.file outFile
+ def preBuildTask = tasks["preBuild"]
+ preBuildTask.dependsOn(newTask)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[07/11] cordova-plugin-file git commit: CB-6428 android: Fix assets
FileEntry having size of -1
Posted by st...@apache.org.
CB-6428 android: Fix assets FileEntry having size of -1
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/ed4cb4b9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/ed4cb4b9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/ed4cb4b9
Branch: refs/heads/old-ID
Commit: ed4cb4b999373eaa80b2fe1f38e3fc24db1b00ae
Parents: 2ce5c49
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 20:58:36 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 20:58:36 2015 -0400
----------------------------------------------------------------------
src/android/AssetFilesystem.java | 75 ++++++++++++++++++++++++-----------
src/android/build-extras.gradle | 7 ++--
2 files changed, 56 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/ed4cb4b9/src/android/AssetFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/AssetFilesystem.java b/src/android/AssetFilesystem.java
index 934a237..f501b27 100644
--- a/src/android/AssetFilesystem.java
+++ b/src/android/AssetFilesystem.java
@@ -43,22 +43,27 @@ public class AssetFilesystem extends Filesystem {
private static Object listCacheLock = new Object();
private static boolean listCacheFromFile;
private static Map<String, String[]> listCache;
+ private static Map<String, Long> lengthCache;
- private String[] listAssets(String assetPath) throws IOException {
+ private void lazyInitCaches() {
synchronized (listCacheLock) {
if (listCache == null) {
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(assetManager.open("cdvasset.manifest"));
listCache = (Map<String, String[]>) ois.readObject();
+ lengthCache = (Map<String, Long>) ois.readObject();
listCacheFromFile = true;
- } catch (FileNotFoundException e) {
- // Asset manifest won't exist if the gradle hook isn't set up correctly.
} catch (ClassNotFoundException e) {
e.printStackTrace();
+ } catch (IOException e) {
+ // Asset manifest won't exist if the gradle hook isn't set up correctly.
} finally {
if (ois != null) {
- ois.close();
+ try {
+ ois.close();
+ } catch (IOException e) {
+ }
}
}
if (listCache == null) {
@@ -67,6 +72,13 @@ public class AssetFilesystem extends Filesystem {
}
}
}
+ }
+
+ private String[] listAssets(String assetPath) throws IOException {
+ if (assetPath.startsWith("/")) {
+ assetPath = assetPath.substring(1);
+ }
+ lazyInitCaches();
String[] ret = listCache.get(assetPath);
if (ret == null) {
if (listCacheFromFile) {
@@ -79,6 +91,39 @@ public class AssetFilesystem extends Filesystem {
return ret;
}
+ private long getAssetSize(String assetPath) throws FileNotFoundException {
+ if (assetPath.startsWith("/")) {
+ assetPath = assetPath.substring(1);
+ }
+ lazyInitCaches();
+ if (lengthCache != null) {
+ Long ret = lengthCache.get(assetPath);
+ if (ret == null) {
+ throw new FileNotFoundException("Asset not found: " + assetPath);
+ }
+ return ret;
+ }
+ CordovaResourceApi.OpenForReadResult offr = null;
+ try {
+ offr = resourceApi.openForRead(nativeUriForFullPath(assetPath));
+ long length = offr.length;
+ if (length < 0) {
+ // available() doesn't always yield the file size, but for assets it does.
+ length = offr.inputStream.available();
+ }
+ return length;
+ } catch (IOException e) {
+ throw new FileNotFoundException("File not found: " + assetPath);
+ } finally {
+ if (offr != null) {
+ try {
+ offr.inputStream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
public AssetFilesystem(AssetManager assetManager, CordovaResourceApi resourceApi) {
super(Uri.parse("file:///android_asset/"), "assets", resourceApi);
this.assetManager = assetManager;
@@ -122,9 +167,6 @@ public class AssetFilesystem extends Filesystem {
}
private boolean isDirectory(String assetPath) {
- if (assetPath.startsWith("/")) {
- assetPath = assetPath.substring(1);
- }
try {
return listAssets(assetPath).length != 0;
} catch (IOException e) {
@@ -187,31 +229,18 @@ public class AssetFilesystem extends Filesystem {
return makeEntryForURL(requestedURL);
}
-
@Override
public JSONObject getFileMetadataForLocalURL(LocalFilesystemURL inputURL) throws FileNotFoundException {
- CordovaResourceApi.OpenForReadResult offr;
- try {
- offr = inputURL.isDirectory ? null : resourceApi.openForRead(toNativeUri(inputURL));
- } catch (IOException e) {
- throw new FileNotFoundException("File not found: " + inputURL);
- }
JSONObject metadata = new JSONObject();
+ long size = inputURL.isDirectory ? 0 : getAssetSize(inputURL.path);
try {
- metadata.put("size", inputURL.isDirectory ? 0 : offr.length);
- metadata.put("type", inputURL.isDirectory ? "text/directory" : offr.mimeType);
+ metadata.put("size", size);
+ metadata.put("type", inputURL.isDirectory ? "text/directory" : resourceApi.getMimeType(toNativeUri(inputURL)));
metadata.put("name", new File(inputURL.path).getName());
metadata.put("fullPath", inputURL.path);
metadata.put("lastModifiedDate", 0);
} catch (JSONException e) {
return null;
- } finally {
- if (offr != null) {
- try {
- offr.inputStream.close();
- } catch (IOException e) {
- }
- }
}
return metadata;
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/ed4cb4b9/src/android/build-extras.gradle
----------------------------------------------------------------------
diff --git a/src/android/build-extras.gradle b/src/android/build-extras.gradle
index 86d91a6..a0a7844 100644
--- a/src/android/build-extras.gradle
+++ b/src/android/build-extras.gradle
@@ -22,21 +22,22 @@ ext.postBuildExtras = {
def outFile = new File(outAssetsDir, "cdvasset.manifest")
def newTask = task("cdvCreateAssetManifest") << {
- println("Reading from ${inAssetsDir}")
- println("Writing to ${outFile}")
-
def contents = new HashMap()
+ def sizes = new HashMap()
contents[""] = inAssetsDir.list()
def tree = fileTree(dir: inAssetsDir)
tree.visit { fileDetails ->
if (fileDetails.isDirectory()) {
contents[fileDetails.relativePath.toString()] = fileDetails.file.list()
+ } else {
+ sizes[fileDetails.relativePath.toString()] = fileDetails.file.length()
}
}
outAssetsDir.mkdirs()
outFile.withObjectOutputStream { oos ->
oos.writeObject(contents)
+ oos.writeObject(sizes)
}
}
newTask.inputs.dir inAssetsDir
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org