Folder configuration

Folder configuration #

Adding dfhack-config/scripts folder #

  1. In VS Codium, go to File > Open Folder.
  1. Pick folder ...\Dwarf Fortress\dfhack-config\scripts - default full path for a Steam installation should be something like C:\Program Files (x86)\Steam\steamapps\common\Dwarf Fortress\dfhack-config\scripts. Click on Select Folder.
  1. Tick the Trust the authors of all files… box and click on Yes, I trust the authors.
  1. You should now have the following view. You can close the Welcome tab.
  1. In Explorer pane, click on the README.md file and familiarize yourself with the content. Close it when you’re done.

Adding hack/scripts folder #

  1. Click on File > Add folder to workspace.
  1. Navigate to Dwarf Fortress/hack/scripts folder and click Add.
  1. Confirm that you trust the authors of files in this folder.
  1. You should now have the following view.

Save workspace file #

  1. Go to File > Save Workspace As…
  1. Change the default name to dfhack.code-workspace and click Save.

Change folder aliases #

  1. Open the dfhack.code-workspace file by clicking on it twice in the Explorer window.
  1. Above each path attribute add a new name attribute. Add the values "My Scripts" and "Default Scripts" for the custom DFHack scripts folder and the default DFHack scripts folder respectively. Don’t forget the comma after the attribute value.
  1. Save the file. You should now have the following view. Note how the folders changed names, so they are now more easily distinguishable.

Forbid editing within hack/scripts folder #

  1. Within the dfhack.code-workspace file, under "settings" add "files.readonlyExclude": {"../../hack/scripts/*.lua": true}.
  1. Save the dfhack.code-workspace file. All the .lua files within Default Scripts folder will now be opened in read-only mode to prevent accidentally overwriting them.

  2. Open the hello-world.lua file in the Default Scripts/devel subfolder by clicking on it twice in the Explorer window.

  3. To indicate the read-only state, there should now be a little padlock to the right of the file name. Try editing the file - a popup appears next to your cursor informing you about the read-only setting.

  1. Close the hello-world.lua file.