Skip to content

Commit

Permalink
Minor cleanup, version 2023Dec21
Browse files Browse the repository at this point in the history
  • Loading branch information
kovzol committed Dec 21, 2023
1 parent d40851d commit 11c2568
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
25 changes: 13 additions & 12 deletions books.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define BIBREF_ADDBOOKS_CACHE_DIR "bibref-addbooks-cache/" // this is hardcoded

#include <limits>
#include <string>
#include <string.h>
Expand Down Expand Up @@ -67,16 +69,6 @@ class NoCitationException: public exception
}
} NoCitationException;

class InternalErrorException: public exception
{
virtual const char* what() const throw()
{
return "Internal error.";
}
} InternalErrorException;



using namespace sword;

vector<Book> books;
Expand Down Expand Up @@ -403,7 +395,7 @@ int addBooks_cached(string moduleName) {
"Revelation_of_John"};
}

string path = "bibref-addbooks-cache/" + moduleName; // hardcoded path
string path = BIBREF_ADDBOOKS_CACHE_DIR + moduleName;

PsalmsInfo pi = PsalmsInfo(moduleName); // create database for Psalms
for (int i=1; i<=151; i++) pi.setLastVerse(i, 0); // initialize
Expand Down Expand Up @@ -458,7 +450,7 @@ int addBooks_cached(string moduleName) {

/// Load a Bible edition, and save it on the disk for a future cache (if there is no cache saved yet).
int addBooks(string moduleName, string firstVerse, string lastVerse, bool removeAccents) {
DIR* cache_dir = opendir(("bibref-addbooks-cache/" + moduleName).c_str()); // This is hardcoded.
DIR* cache_dir = opendir((BIBREF_ADDBOOKS_CACHE_DIR + moduleName).c_str());
if (cache_dir) { // If there is a cache saved on the disk, we'll use it.
closedir(cache_dir);
addBooks_cached(moduleName); // Load the book from the cache.
Expand Down Expand Up @@ -725,6 +717,15 @@ int compare(string verse1, string verse2) {
/* The following part is experimental code and currently unmaintained. */

/*
class InternalErrorException: public exception
{
virtual const char* what() const throw()
{
return "Internal error.";
}
} InternalErrorException;
typedef struct FingerprintInfo {
Fingerprint m_fp;
Book *m_book;
Expand Down
2 changes: 1 addition & 1 deletion cli.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define BIBREF_VERSION "2023Dec20"
#define BIBREF_VERSION "2023Dec21"

#include <iostream>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bibref
base: core20
version: '2023Jul30'
version: '2023Dec21'
summary: A tool that helps discovering internal references in the Bible
icon: logo-Psalm40-192.png
description: |
Expand Down

0 comments on commit 11c2568

Please sign in to comment.