Skip to content

dialog.showOpenDialog doesn't return an array of string but a promise. #6

@ghost

Description

Listing 4.2 doesn't work since dialog.showOpenDialog doesn't return an array of string but a promise according to the doc.
Hence the listing 4.2 need to be modify in order to take it into account.

const getFileFromUser = () => {
  const files = dialog.showOpenDialog({
    properties: ["openFile"],
  });
  files
    .then((value) => {
      if (value.canceled == true) return;
      console.log(value.filePaths);
    })
    .catch((err) => console.log(err));
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions