getEntryWithUrl not accepting valid path

I’m trying out the new getEntryWithUrl() method and I’m not having much luck. I’ve included fs.readdir() to test the path is working. readdir returns the folder contents fine, but getEntryWithUrl throws its toys out of the pram with the same path. I also included the example from the documentation for accessing the plugin data folder and it returns the same error.
Anyone got this to work yet that can provide some pointers? Or alternatively, is getEntryWithUrl pre-release?

PS: 24.2.0
API: 2
Manifest: 5 (fullAccess granted)

 const { app } = require("photoshop");
 const fs = require("fs");
 const fsp = require("uxp").storage.FileSystemProvider;

 // Get path to activeDocument folder
 const doc = app.activeDocument;
 const path = doc.path.slice(0, doc.path.lastIndexOf("\\"));

 console.log("paths", path);

 // Read contents of activeDocument folder
 const readPathFolder = await fs.readdir(`file:/${path}`);

 console.log("folders", readPathFolder);

 // Get entry with url ???
 const dataFolder = await fsp.getEntryWithUrl(`plugin-data:/`);
 const pathFolder = await fsp.getEntryWithUrl(`file:/${path}`);

 console.log("entries", { dataFolder, pathFolder });

1 Like

Do not require FileSystemProvider directly, but require its instance, localFileSystem.

const fsp = require("uxp").storage.localFileSystem;
2 Likes

@sttk3 you beauty, thank you!

1 Like

@Timothy_Bennett please could you check that my manifest passes all the requirements to use getEntryWithUrl(), I am not succeeding in my attempts. Thanks.

{
  "id": "UXP-TESTES",
  "name": "UXP-testes",
  "version": "1.0.0",
  "host": [
    {
      "app": "PS",
      "minVersion": "24.2.0"
    }
  ],
	"requiredPermissions": {
	"localFileSystem": "fullAccess"
	}
  ,
  "main": "index.html",
  "manifestVersion": 5,
  "requiredPermissions": {
    "network": {
      "domains": [
        "https://source.unsplash.com"
      ]
    },
    "clipboard": "readAndWrite",
    "localFileSystem": "request",
    "ipc": {
      "enablePluginCommunication": true
    }
  },
  "entrypoints": [
    {
      "type": "panel",
      "id": "vanilla",
      "label": {
        "default": "UXP-testes",
        "en-US": "UXP-testes",
        "es-ES": "UXP-testes"
      },
      "minimumSize": {
        "width": 160,
        "height": 350
      },
      "maximumSize": {
        "width": 160,
        "height": 350
      },
      "preferredDockedSize": {
        "width": 160,
        "height": 350
      },
      "preferredFloatingSize": {
        "width": 160,
        "height": 350
      },
      "commands": [
        {
          "id": "show_alert",
          "label": {
            "default": "Show Alert",
            "en-US": "Show Alert (US)",
            "es-ES": "Show Alert (ES)"
          }
        }
      ],
      "icons": [
        {
          "width": 32,
          "height": 32,
           "path": "icons/light.png",
          "scale": [1,2],
          "theme": [ "dark", "darkest"
          ],
          "species": [
            "generic"
          ]
        },
        {
          "width": 32,
          "height": 32,
          "path": "icons/dark.png",
           "scale": [
            1,
            2
          ],
          "theme": [ "lightest", "light" ],
          "species": [
            "generic"
          ]
        }
      ]
    }
  ],
  "icons": [
    {
      "width": 32,
      "height": 32,
      "path": "icons/icon_D.png",
      "scale": [
        1,
        2
      ],
      "theme": [
        "dark",
        "darkest"
      ],
      "species": [
        "generic"
      ]
    },
    {
      "width": 32,
      "height": 32,
      "path": "icons/icon_N.png",
      "scale": [
        1,
        2
      ],
      "theme": [
        "lightest",
        "light"
      ],
      "species": [
        "generic"
      ]
    }
  ]
}

You’ve added your local required permissions field under host, you just need to delete that and add localFileSystem: "full Access" to the existing required permissions field at the top level of the manifest Object:

1 Like

Thanks @Timothy_Bennett