#Command 'watch' not found

9 messages · Page 1 of 1 (latest)

dry plover
#

Hi guys,

I migrated from V1 to V2 recently and in general i'm a bit confused with the new capabilities object and permissions in general.

I would like to watch my 'Desktop' folder example with the 'watchImmediate' function, but I receive this error in the console.

My main.json in the capabilities looks like this.

{
    "identifier": "main-capability",
    "description": "Capability for the main window",
    "windows": [
        "main"
    ],
    "permissions": [
        {
            "identifier": "fs:allow-watch",
            "allow": [{ "path": "DESKTOP/**" }]
        },
        {
            "identifier": "fs:allow-read-dir",
            "allow": [{ "path": "$HOME/**" }]
        },
        "path:default",
        "event:default",
        "dialog:allow-open",
        "window:default",
        "app:default",
        "resources:default",
        "menu:default",
        "tray:default",
        "window:allow-set-title"
    ]
}

and my tauri.conf.json looks like this

{
 
    "app": {
        "windows": [
            {
                "title": "invoicemate2",
                "width": 800,
                "height": 600
            }
        ],
        "security": {
            "csp": null
        }
    },
    "bundle": {
        "active": true,
        "targets": "all",
        "icon": [
            "icons/32x32.png",
            "icons/128x128.png",
            "icons/[email protected]",
            "icons/icon.icns",
            "icons/icon.ico"
        ]
    },
    "plugins": {
        "fs": {
            "scope": [
                "$DESKTOP/**",
                "$HOME/**"
            ]
        }
    }
}

In my React app I try to start watching the desktop folder, but I receive the error above. (see title)..

Thanks in advance.

storm geyser
#

i don't think this is related to the capability. Can you make sure that the tauri-plugin-fs dependency in cargo.toml has features = ["watch"] ?

dry plover
#

Ooooh, thanks @storm geyser . This was the solution

#

I was looking for hours to find why this was not working.

#

But where is this documented in the V2 docs ? Can you link to it ?

storm geyser
#

the v2 docs are very incomplete right now so it's probably not mentioned anywhere.

dry plover
#

Ok, no problem. No problem. Thanks for the help anyway @storm geyser

#

Maybe one more question, in which cases do I need to extend or declare the features of (some?) plugins in the cargo.toml?

storm geyser
#

whenever we deem something to be edge-case-y enough to not enable it for every user, especially if it adds additional dependencies.
Until we have properly documented this you can check the plugin's Cargo.toml file in the git repo for a [features] section.