Skip to content

Commit

Permalink
fix paths for finding needed original resources
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotoNomad0 committed Jan 10, 2022
1 parent a49ebcf commit 4580664
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"string-punctuation-tokenizer": "^2.2.0",
"sudo-prompt": "6.2.1",
"tc-electron-env": "0.9.0",
"tc-source-content-updater": "0.9.1-alpha.4",
"tc-source-content-updater": "0.9.1",
"tc-strings": "0.1.7",
"tc-tool": "4.1.0",
"tc-ui-toolkit": "6.0.0",
Expand Down
13 changes: 7 additions & 6 deletions src/js/helpers/ResourcesHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,16 +1208,17 @@ export function moveResourcesFromOldGrcFolder() {
/**
* find out which Original Language Bible versions are needed by installed tNs. Only keep the needed versions.
* The other versions are deleted.
* @param languageId
* @param resourceId
* @param resourcePath
* @param {string} languageId
* @param {string} resourceId
* @param {string} resourcePath - path for versions of current resource
* @param {string} resourcesPath - base path for all resources
* @return {boolean} - returns true if all old resources can be deleted
*/
export function preserveNeededOrigLangVersions(languageId, resourceId, resourcePath) {
export function preserveNeededOrigLangVersions(languageId, resourceId, resourcePath, resourcesPath) {
let deleteOldResources = true; // by default we do not keep old versions of resources

if (BibleHelpers.isOriginalLanguageBible(languageId, resourceId)) {
const requiredVersions = getOtherTnsOLVersions(resourcePath, resourceId).sort((a, b) =>
const requiredVersions = getOtherTnsOLVersions(resourcesPath, resourceId).sort((a, b) =>
-ResourceAPI.compareVersions(a, b), // do inverted sort
);
console.log('preserveNeededOrigLangVersions: requiredVersions', requiredVersions);
Expand Down Expand Up @@ -1310,7 +1311,7 @@ export function getMissingResources() {
isOldResource = true;
}

const deleteOldResources = preserveNeededOrigLangVersions(languageId, resourceId, userResourcePath);
const deleteOldResources = preserveNeededOrigLangVersions(languageId, resourceId, userResourcePath, USER_RESOURCES_PATH);

if (isOldResource) {
console.log(`getMissingResources() - checking ${languageId} ${resourceId} - old resource found`);
Expand Down

0 comments on commit 4580664

Please sign in to comment.