Skip to content

Unable to import exams in macos #12

Description

@rubenandre

Describe the bug
When importing a file in macos they generate a exception

To Reproduce
Steps to reproduce the behavior:

  1. Import file

Expected behavior
The exam file should be loaded

Desktop (please complete the following information):

  • OS: MacOS
  • Version: Monterrey

Additional context
The error it's located in showFileDialog.js line 31. The following code only works on windows:

const filename = filepaths[0].split('\\').pop()

One possible solution for this problem is create the following function

const getOs = () => {
  const os = ['Windows', 'Linux', 'Mac']; // add your OS values
  return os.find(v=>window.navigator.appVersion.indexOf(v) >= 0);
}

and replace line 31 with:

const os = getOs()

let filename = null
if (os == 'Windows') {
    filename = filepaths[0].split('\\').pop()
} else {
    filename = filepaths[0].split('/').pop()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions