#Creating/reading hidden files on macOS

7 messages · Page 1 of 1 (latest)

mellow prairie
#

I'm trying to create and read a hidden file (A file that begins with a dot) using the fs plugin, in tauri v2. The error im getting whenever I try to do either is: Unhandled Promise Rejection: forbidden path: /Users/path/.filename

These are the fs capabilities I've got set up.

"fs:default",
{
  "identifier": "fs:scope",
  "allow": [{ "path": "/" }, { "path": "/**" }]
},
"fs:allow-home-write-recursive",
"fs:allow-home-read-recursive",

Any ideas?

ember dawn
#

Add "requireLiteralLeadingDot": false to every object which contains the "path": ...

#

For instance

 "fs:default",
    {
      "identifier": "fs:scope",
      "allow": [{ "path": "/", "requireLiteralLeadingDot": false }, { "path": "/**", "requireLiteralLeadingDot": false }]
    },
    "fs:allow-home-write-recursive",
    "fs:allow-home-read-recursive",
mellow prairie
#

Cheers, that worked!

old path
#

@ember dawn Thanks man, it saved me a lot of time

trail moon
#

@ember dawn When using it with fs-watch it throws this error. However if i watch the entire directory, it works well, but just looking at the hidden folder doesn't.

Here's my permissions

{
      "identifier": "fs:allow-exists",
      "allow": [
        {
          "path": "**",
          "requireLiteralLeadingDot": false
        }
      ]
    },
    {
      "identifier": "fs:allow-watch",
      "allow": [
        {
          "path": "**",
          "requireLiteralLeadingDot": false
        }
      ]
    },
    {
      "identifier": "fs:allow-unwatch",
      "allow": [
        {
          "path": "**",
          "requireLiteralLeadingDot": false
        }
      ]
    },
    {
      "identifier": "fs:scope",
      "allow": [
        {
          "path": "**",
          "requireLiteralLeadingDot": false
        }
      ]
    },

And I'm using it like this

  let stopWatchingPromise = watch(path, updateResponse, {
      recursive: true,
      delayMs: 1,
    });