mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 19:42:17 +02:00
fixed: impossible to access archive inside assets
This commit is contained in:
parent
73e8aa1bce
commit
eadd934695
21 changed files with 30 additions and 9 deletions
Binary file not shown.
0
assets/languagePatterns/cs_tmp
Normal file
0
assets/languagePatterns/cs_tmp
Normal file
0
assets/languagePatterns/de-traditional_tmp
Normal file
0
assets/languagePatterns/de-traditional_tmp
Normal file
0
assets/languagePatterns/de_tmp
Normal file
0
assets/languagePatterns/de_tmp
Normal file
0
assets/languagePatterns/el_tmp
Normal file
0
assets/languagePatterns/el_tmp
Normal file
0
assets/languagePatterns/en_tmp
Normal file
0
assets/languagePatterns/en_tmp
Normal file
0
assets/languagePatterns/eo_tmp
Normal file
0
assets/languagePatterns/eo_tmp
Normal file
0
assets/languagePatterns/es_tmp
Normal file
0
assets/languagePatterns/es_tmp
Normal file
0
assets/languagePatterns/fi_tmp
Normal file
0
assets/languagePatterns/fi_tmp
Normal file
0
assets/languagePatterns/fr_tmp
Normal file
0
assets/languagePatterns/fr_tmp
Normal file
0
assets/languagePatterns/id_tmp
Normal file
0
assets/languagePatterns/id_tmp
Normal file
0
assets/languagePatterns/it_tmp
Normal file
0
assets/languagePatterns/it_tmp
Normal file
0
assets/languagePatterns/no_tmp
Normal file
0
assets/languagePatterns/no_tmp
Normal file
0
assets/languagePatterns/pt_tmp
Normal file
0
assets/languagePatterns/pt_tmp
Normal file
0
assets/languagePatterns/ru_tmp
Normal file
0
assets/languagePatterns/ru_tmp
Normal file
0
assets/languagePatterns/sv_tmp
Normal file
0
assets/languagePatterns/sv_tmp
Normal file
0
assets/languagePatterns/tr_tmp
Normal file
0
assets/languagePatterns/tr_tmp
Normal file
0
assets/languagePatterns/uk_tmp
Normal file
0
assets/languagePatterns/uk_tmp
Normal file
|
@ -42,7 +42,7 @@ public abstract class ZLResourceFile extends ZLFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNameWithExtension() {
|
public String getNameWithExtension() {
|
||||||
return myPath;
|
return myPath.substring(myPath.lastIndexOf('/') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLFile getParent() {
|
public ZLFile getParent() {
|
||||||
|
|
|
@ -55,6 +55,6 @@ public abstract class ZLLanguageList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ZLFile patternsFile() {
|
public static ZLFile patternsFile() {
|
||||||
return ZLResourceFile.createResourceFile("languagePatterns.tar");
|
return ZLResourceFile.createResourceFile("languagePatterns");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.geometerplus.zlibrary.ui.android.library;
|
package org.geometerplus.zlibrary.ui.android.library;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
@ -31,6 +31,7 @@ import android.text.format.DateFormat;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
|
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||||
|
@ -87,7 +88,6 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
||||||
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
||||||
externalUrl = false;
|
externalUrl = false;
|
||||||
}
|
}
|
||||||
// FIXME: initialize network library and use rewriteUrl!!!
|
|
||||||
final NetworkLibrary nLibrary = NetworkLibrary.Instance();
|
final NetworkLibrary nLibrary = NetworkLibrary.Instance();
|
||||||
try {
|
try {
|
||||||
nLibrary.initialize();
|
nLibrary.initialize();
|
||||||
|
@ -149,19 +149,40 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists() {
|
protected List<ZLFile> directoryEntries() {
|
||||||
|
try {
|
||||||
|
String[] names = myApplication.getAssets().list(getPath());
|
||||||
|
if (names != null && names.length != 0) {
|
||||||
|
ArrayList<ZLFile> files = new ArrayList<ZLFile>(names.length);
|
||||||
|
for (String n : names) {
|
||||||
|
files.add(new AndroidAssetsFile(getPath() + "/" + n));
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDirectory() {
|
||||||
try {
|
try {
|
||||||
AssetFileDescriptor descriptor = myApplication.getAssets().openFd(getPath());
|
AssetFileDescriptor descriptor = myApplication.getAssets().openFd(getPath());
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
descriptor.close();
|
descriptor.close();
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
return false;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean exists() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long size() {
|
public long size() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue