system.file.writeFile not working on Mac

I have a Perspective script that creates a PDF with system.report.executeReport and then saves it to the device with system.perspective.download. This works, I see the PDF on my device where I expect it.

I now want to save the same PDF to the Downloads folder on my Gateway. My code is:

GatewayPath = "~/Downloads/Gateway" + filename 
system.file.writeFile(GatewayPath , report_array)
logger.info("Confirm save PDF to gateway " + GatewayPath)

I see no error in code, it runs successfully and the logger shows up as expected. However, I do not see any PDF written on my Mac. What could be happening?

Try a fully qualified path, not the shortcut ~/Downloads.

1 Like

Thanks PGriffith, "/Users/{username}/Downloads" works!

1 Like