objecthub / swift-lispkit

Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. LispKit is fully implemented in Swift 5.
https://lisppad.app
Apache License 2.0
392 stars 16 forks source link

LispPad, cannot open file '...' #4

Closed jkleiser closed 6 years ago

jkleiser commented 6 years ago

I am completely new to LispPad. I wanted to try PDF generation, and I ran the PDF.scm. It ended with "pdfex4" in the Console, and when I typed pdfex1, I got "#<procedure pdfex1@600000a97b60>", which looks OK to me. However, when I do

(pdfex1 "/Volumes/P3/Lisp/ex1.pdf")

I get this: cannot open file '/Volumes/P3/Lisp/ex1.pdf'

Why cannot this file be created?

objecthub commented 6 years ago

LispPad is a sandboxed application and you cannot write files outside of the sandbox unless you (manually) authorize access. If you just want to create files, I would create them within the sandbox and then simply refer to them from Finder.

For instance, you can create a PDF file like this:

(pdfex1 "ex1.pdf")

The location of the generated file can be found using the function file-path:

(file-path "ex1.pdf")
→ "/Users/yourusername/Library/Containers/net.objecthub.LispPad/Data/ex1.pdf"

The only other alternative is currently to declare, e.g. your home directory, as a location for libraries via the Preferences (Environment tab). This will give you access to your full home directory bypassing the sandbox. This is obviously a hack. Finding a better solution is currently on my todo list.

jkleiser commented 6 years ago

Thanks!

jkleiser commented 6 years ago

Maybe the LispPad app could have a menu item that said something like "Open LispPad/Data in Finder"?

objecthub commented 6 years ago

The latest version of LispPad has a means to declare a home folder outside of the sandbox. Also the mechanism to persist access to such a folder is working now. Thanks a lot for reporting this issue.