Skip to content

Improve validation of user provided path #9

@eslym

Description

@eslym

Currently bdcli expected the --path given by user matched in the discovered list of paths

install = discord.ResolvePath(pathFlag)

index := slices.IndexFunc(allDiscordInstalls[channel], func(d *DiscordInstall) bool { return d.CorePath == proposed })

Which causing manual path would fail when the internal path resolution failed

$ bdcli install -p ~/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/
Error: could not find a valid Discord installation at ***/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/
Usage:
  bdcli install [flags]

Aliases:
  install, reinstall

Flags:
  -c, --channel string   Discord release channel (stable|ptb|canary) (default "stable")
  -h, --help             help for install
  -p, --path string      Path to a Discord installation

Global Flags:
      --silent   Suppress non-error output

could not find a valid Discord installation at ***/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/

Suggestion:

Validate the --path by checking the existence of package.json or even the content of it

Related to: #8 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions