Files being intermittently erased from plugin data folder

In one of my plugin I’m storing data in
Mac: /Users/<username>/Library/Application Support/
Windows: C:\Users\<username>\AppData\Roaming\

This is how I get the entry without a folder dialog but you need to set this permission in the manifest:

"requiredPermissions": {
     "localFileSystem": "fullAccess"
 }

This permission does not require any user intervention while using the plugin.

const fs = require("uxp").storage.localFileSystem;
const os = require("os");

const getPathEntry = async () => {
        let p;
        const homedir = os.homedir();
        const platform = os.platform();
        if (platform === "darwin") {
            // Mac
            p = path.join(homedir, "Library", "Application Support");
        } else {
            // Windows
            p = path.join(homedir, "AppData", "Roaming");
        }
        const pathEntry = await fs.getEntryWithUrl(p);
        return pathEntry;
};

getEntryWithUrl was implemented with UXP 6.5 (Photoshop 24.2).

1 Like