Skip to content

Commit

Permalink
Use path.basename and path.join
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Feb 28, 2024
1 parent a74167a commit d2c6367
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
12 changes: 5 additions & 7 deletions packages/text-indexing/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isSupportedIndexingAdapter } from '@jbrowse/core/util'
import path from 'path'

export interface UriLocation {
uri: string
Expand Down Expand Up @@ -123,23 +124,20 @@ export function createTextSearchConf(
assemblyNames: string[],
locationPath: string,
) {
// const locationPath = self.sessionPath.substring(
// 0,
// self.sessionPath.lastIndexOf('/'),
// )
const base = path.join(locationPath, 'trix')
return {
type: 'TrixTextSearchAdapter',
textSearchAdapterId: name,
ixFilePath: {
localPath: locationPath + `/trix/${name}.ix`,
localPath: path.join(base, `${name}.ix`),
locationType: 'LocalPathLocation',
},
ixxFilePath: {
localPath: locationPath + `/trix/${name}.ixx`,
localPath: path.join(base, `${name}.ixx`),
locationType: 'LocalPathLocation',
},
metaFilePath: {
localPath: locationPath + `/trix/${name}.json`,
localPath: path.join(base, `${name}.json`),
locationType: 'LocalPathLocation',
},
tracks: trackIds,
Expand Down
19 changes: 10 additions & 9 deletions products/jbrowse-desktop/src/indexJobsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import {
findTrackConfigsToIndex,
} from '@jbrowse/text-indexing'
import { isAbortException, isSessionModelWithWidgets } from '@jbrowse/core/util'
import clone from 'clone'
import path from 'path'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Track = Record<string, any>
interface Track {
trackId: string
assemblyNames: string[]
[key: string]: unknown
}

interface TrackTextIndexing {
attributes: string[]
Expand All @@ -33,11 +38,7 @@ interface JobsEntry {
statusMessage?: string
}
export interface TextJobsEntry extends JobsEntry {
name: string
indexingParams: TrackTextIndexing
cancelCallback?: () => void
progressPct?: number
statusMessage?: string
}

export default function jobsModelFactory(_pluginManager: PluginManager) {
Expand Down Expand Up @@ -69,14 +70,14 @@ export default function jobsModelFactory(_pluginManager: PluginManager) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return getParent<any>(self).session
},
get aggregateTextSearchAdapters() {
get aggregateTextSearchAdapters(): { textSearchAdapterId: string }[] {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return getParent<any>(self).jbrowse.aggregateTextSearchAdapters
},
get location() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const path = getParent<any>(self).sessionPath
return path.slice(0, Math.max(0, path.lastIndexOf('/')))
const sessionPath = getParent<any>(self).sessionPath
return path.basename(sessionPath)
},
}))
.actions(self => ({
Expand Down

0 comments on commit d2c6367

Please sign in to comment.