Skip to content

Commit

Permalink
fix: pathing issue with file updates
Browse files Browse the repository at this point in the history
Also fixes gcode preview not loading from subpaths

Signed-off-by: Craig Bassett <[email protected]>
  • Loading branch information
cadriel committed Jun 29, 2021
1 parent 7a7484d commit 32563d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/store/files/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ export const actions: ActionTree<FilesState, RootState> = {
const root = 'gcodes' // We'd only ever load metadata for gcode files.
const paths = getFilePaths(payload.filename, root)
const file = formatAsFile(root, payload)
const filepath = (file.path) ? `${file.path}/${file.filename}` : `${file.filename}`

// If this is an update to the currently printing file, then push it to
// current_file.
if (file.filename === rootState.printer?.printer.print_stats.filename) {
if (filepath === rootState.printer?.printer.print_stats.filename) {
commit('printer/setSocketNotify', { key: 'current_file', payload: file }, { root: true })
}

Expand Down
2 changes: 2 additions & 0 deletions src/util/format-as-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export default (root: string, file: FileChangeItem | KlipperFile | KlipperFileWi
modified: file.modified
}
}

const paths = getFilePaths(file.filename, root)
return {
...file,
type: 'file',
filename: paths.filename,
extension: paths.filename.split('.').pop() || '',
name: paths.filename,
path: paths.path
Expand Down

0 comments on commit 32563d3

Please sign in to comment.