uiconfig = new UiConfigBundle();
trans = new StringIdBundle(getLang());
- try {
- lib = new LocalLibrary(getFile(Config.LIBRARY_DIR));
- } catch (Exception e) {
- syserr(new IOException("Cannot create library for directory: "
- + getFile(Config.LIBRARY_DIR), e));
- }
boolean debug = Instance.getConfig()
.getBoolean(Config.DEBUG_ERR, false);
tracer.setShowErrorDetails(debug);
tracer.setShowTraces(trace);
+ try {
+ lib = new LocalLibrary(getFile(Config.LIBRARY_DIR));
+ } catch (Exception e) {
+ syserr(new IOException("Cannot create library for directory: "
+ + getFile(Config.LIBRARY_DIR), e));
+ }
+
// Could have used: System.getProperty("java.io.tmpdir")
if (tmp == null) {
tmp = new File(configDir, "tmp");
* @return the {@link LocalLibrary}
*/
public static BasicLibrary getLibrary() {
+ if (lib == null) {
+ throw new NullPointerException("We don't have a library to return");
+ }
+
return lib;
}
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.library.BasicLibrary;
import be.nikiroo.fanfix.library.CacheLibrary;
-import be.nikiroo.fanfix.library.LocalLibrary;
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.Version;
import be.nikiroo.utils.ui.UIUtils;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
}
tmpInfo.delete();
} else {
+ if (title == null || title.isEmpty()) {
+ title = new File(source.getPath()).getName();
+ if (title.toLowerCase().endsWith(".cbz")) {
+ title = title.substring(0, title.length() - 4);
+ }
+ title = URLDecoder.decode(title, "UTF-8").trim();
+ }
+
meta = new MetaData();
meta.setLang("EN");
meta.setTags(new ArrayList<String>());