Skip to content
David Foster edited this page Jan 27, 2024 · 7 revisions

A *.crystalproj project in Crystal can be opened in read-only mode.

How does a read-only project behave differently?

Crystal will never attempt to modify a read-only project. Any attempt to download new URLs or perform other modifications to a read-only project will fail with an error message (in the GUI) or with a ProjectReadOnlyError (in the shell). Additionally no newly-discovered URLs will be dynamically downloaded while browsing the served URLs in a read-only project.

Why might I want to force a project to be opened as read-only, and how do I do that?

It is useful to force a project to be read-only if you finish downloading a site to it and you don't want to accidentally modify the project further in the future.

To open a project as read-only temporarily:

  • When opening a project in the GUI, check the "Open as read only" checkbox:
Screen Shot 2022-06-30 at 7 20 27 AM
  • When opening a project in the CLI, use the --readonly option.

To force a particular project to always open as read-only:

  • On macOS, right-click the *.crystalproj file in Finder and choose Get Info. A file info popup will appear. Check the "Locked" checkbox in the popup. Close the popup.
Screen Shot 2022-06-26 at 2 29 04 PM
  • On Windows, open the *.crystalproj directory in Windows Explorer to reveal the contained database.sqlite file. Right-click the database.sqlite file and choose Properties. A properties popup will appear. Check the "Read Only" checkbox in the popup. Close the popup.
Screen Shot 2022-06-26 at 2 32 36 PM

When is a project opened as read-only?

A project is opened as read-only iff:

  • the user requests it by checking the "Open as read only" checkbox when opening a project in the GUI,
  • the user requests it by providing the --readonly option when running Crystal from the command-line,
  • its *.crystalproj package is marked as Locked in macOS Finder,
  • its *.crystalproj/database.sqlite file is marked as Locked in macOS Finder or as Read Only in Windows, or
  • it resides on a read-only volume (such as a DVD, CD, or other optical disc).
Clone this wiki locally