Skip to content

Commit

Permalink
Check if tp directory is writable.
Browse files Browse the repository at this point in the history
  • Loading branch information
aacic committed Oct 13, 2023
1 parent b3ac94e commit 5b88975
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions server/dataset/termdb.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Mds3 } from '../shared/types'
import * as serverconfig from '@sjcrh/proteinpaint-server/src/serverconfig.js'
import * as path from 'path'
import { existsSync, unlinkSync, symlinkSync } from 'fs'
import { existsSync, unlinkSync, symlinkSync, access, constants } from 'fs'

/*
the "test mule" for the type of termdb dataset using server-side sqlite3 db
Expand Down Expand Up @@ -244,11 +244,17 @@ function copyDataFilesFromRepo2Tp() {
const datadir = path.join(serverconfig.tpmasterdir, 'files/hg38/TermdbTest')

if (!targetDir.endsWith(datadir)) {
try {
if (existsSync(datadir)) unlinkSync(datadir)
symlinkSync(targetDir, datadir)
} catch (error) {
console.warn('Error while coping data files from Repo to Tp: ' + error)
}
access(datadir, constants.R_OK | constants.W_OK, err => {
if (!err) {
try {
if (existsSync(datadir)) unlinkSync(datadir)
symlinkSync(targetDir, datadir)
} catch (error) {
console.warn('Error while coping data files from Repo to Tp: ' + error)
}
} else {
console.warn(`user doesn't have sufficient permissions for `)
}
})
}
}

0 comments on commit 5b88975

Please sign in to comment.