getResourcePath() does not return the correct path for user defined attachment folder

I think you can use: this.app.vault.getConfig("attachmentFolderPath") see: