Skip to content

Commit

Permalink
add a check if the folder exists
Browse files Browse the repository at this point in the history
  • Loading branch information
danielc-n committed Apr 3, 2024
1 parent 7eafc20 commit 4b84d64
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion renderer/src/components/EditorPage/Reference/OBS/ObsTn.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ function ObsTnCard({
if (offlineResource.data?.value?.dublin_core?.format?.toLowerCase() === 'text/tsv') {
logger.debug('inside OBS TN offline TSV resource');
let tsvFileName = offlineResource.data?.value?.projects[0]?.path;
let fullPathTsv = path.join(folder, projectName, tsvFileName);
// sometimes people put the path of the content dir instead of the name of the tsv file
if(fs.lstatSync(path.join(folder, projectName, tsvFileName),).isDirectory()) {
if(!fs.existsSync(fullPathTsv) || fs.lstatSync(fullPathTsv).isDirectory()) {
tsvFileName = fs.readdirSync(path.join(folder, projectName)).filter(fn => fn.endsWith('.tsv'))[0];
}
const obsTsvData = await fs.readFileSync(path.join(folder, projectName, tsvFileName), 'utf8');
Expand Down

0 comments on commit 4b84d64

Please sign in to comment.