Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import exams in macos #12

Open
rubenandre opened this issue Dec 4, 2021 · 0 comments
Open

Unable to import exams in macos #12

rubenandre opened this issue Dec 4, 2021 · 0 comments

Comments

@rubenandre
Copy link

rubenandre commented Dec 4, 2021

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()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant