How to Use the File Editor in the Nodecraft File Manager
In the Nodecraft Control panel NodePanel, we offer the ability to open a text editor in the file manager, which will allow you to edit or create text files directly on the server!
This guide has separate sections which will show how to edit existing text files, or create new ones. There is also a section at the very end that discusses text files that have special syntax rules, like .json
format files (which are used by many games for configuration files).
Editing an Existing File
Select a Single File
To edit an existing text file on the server, please navigate to the "File Manager" section on the left side of the Nodecraft control panel. Then, navigate to the folder that contains the file you want to edit.
In order to edit a file, you have to "select" the file first:
This is done by clicking on the file, or the small box to the left of the file name you want to edit.
A small check mark appears in the box, and the entire file name line will be highlighted bright blue.
Click the "Edit" Button
Click on the "Edit" button that appears above the file manager window, when you have a file selected. This will cause the file manager to switch to a special view which shows the contents of the file.
If you don't see an "Edit" button, it may because too many files have been selected. The "Edit" option is only available when you have a single file selected.
Contents of file will be displayed
The contents of the config file will replace the file listings section of the File Manager window.
A flashing cursor bar will appear in the file. You can move the position of the cursor by using arrow/directional keys on your keyboard, or by clicking in a new position with the mouse. You can edit existing text, or type in completely new lines.
When you are finished making changes to the file, click on the blue "Save" button. If you change your mind about editing the file, you can click on the "Cancel" button to exit without making any changes.
Some files can't be opened in the editor
The text editor can only display the contents of certain types of file formats (text files). If the file can't be edited with a standard text editor, you will see this error message pop up in the middle of the screen.
Creating an Entirely New Text File
You can create a new text file directly in the File Manager, by clicking on the "Create File" button.
The "Create File" button is normally visible at the top of the File Manager window, as long as you have not selected any files or folders.
Enter a Filename
Enter a name for the file, by typing directly into the area with eg. my-file-name.txt
in dark grey text. Make sure to include the file extender as part of the name, like .txt
.
Enter Text into the File
Enter your text on line 1, where you see the flashing cursor bar. Hit enter
to create new lines in the text file.
When you're finished, click the blue "Save" button to create the file!
If the "Save" button is dark blue (disabled), and you cannot click on it, that often means that the file name hasn't been entered already. The control panel cannot make a file if it has no file name. Please enter a name, and the dark blue "Save" button should turn to a bright blue, and can be clicked on to save the file.
File Syntax Warnings
Some text file formats have very specific rules that control how the information is entered into the file.
If the rules for these formats are not followed, it will cause errors when the game attempts to read these files. This can prevent games from starting up, cause errors, or even possibly cause crashes.
JSON (.json
) Format
One commonly used format that must follow these exact rules, are JSON (.json
) format files. They will have files names that end in the extension .json
.
JSON files are used by many games for config files (including Minecraft, Terraria, Eco, and many many others). These files make extensive use of brackets, quote marks, and commas through the file format to package and prepare the information for programs to use it correctly.
Syntax Warnings
In order to help you with this syntax, the Nodecraft text editor includes a simple parser that double checks the syntax (the rules) are being followed for many file types including JSON, TOML, and more.
It will display a warning message directly in the text editor, that informs you if the syntax rules for JSON have been violated. This lets you know the game will have issues with that file if it's saved like that.
For example, below is a config file for the game "Terraria", which is in JSON format. It is currently in the correct format, so there are no warnings.
In the screenshot below, a single comma has been deleted from the end of the 3rd line. This breaks the syntax rules for JSON, and the game would now have trouble reading this file if it was saved like this, just because of a single missing character.
The text editor has displayed two warnings on screen about the syntax:
The yellow box in the upper right that says "There are syntax errors in this file"
The red circle with a white "X", which has been placed on the line near the error.
If you move your mouse over the red circle with the white "X", a popup will appear, that shows the syntax rules that have been broken.
The rules for JSON are fairly complex, so it might be difficult to interpret what the error message is actually saying. Sometimes the actual problem might be several lines above or below that point. But in this case, it's a very simple violation (a single missing comma), and it's highlighting that it expected to find a comma at the end of the line.
There are many site available online that discuss the exact syntax required for JSON format files, that can help you understand the actual error messages if something is wrong with the file.