4coder»Blog

4coder's New Project Files

This is a post to briefly describe the new 4coder project file feature in alpha 4.0.14.

The feature is meant to support the common situation where just having one build rule that is always in a "build.bat" or "build.sh" for the entire project is not always enough. Obviously anyone with access to the customisation layer has always been able to extend this, but the project file system creates some built in project configuration possibility. It also solves several other smaller issues, but we'll get to that in a minute.

The way it works is you create a "project.4coder" file in the root directory of the project. With 4coder running you can launch a project by navigating to the directory containing the project file and running 'load project'. Loading the project also opens all the code in the directory. Unlike the 'open all code' version, this version reads an extensions setting out of the project file, so you can set any set of extensions to open with the project.

Once the project is open the f keys are all assigned a command to execute and an output buffer where the command results will be sent. This can include various build script configurations, other types of scripts, or any terminal commands available on the platform at all.

Another advantage of this new system is that it always runs the command from the project root directory, even if you have navigated the 4coder hot directory into a subdirectory or outside of the project. This helps you to guarantee where your scripts can be found and know what directory they will run in.

Here is an example project.4coder file that is similar to default 4coder behaviour using F1 as the build key:

1
2
3
4
5
extensions=".c.cpp.h.hpp.cc";

fkey_command_win[1] = {"build.bat", "*compilation*", true};

fkey_command_linux[1] = {"build.sh", "*compilation*", true};


The first line sets the extensions to the standard C/C++ extensions. Since commands will differ from platform to platform each platform gets it's own command array. The index [1] says that the command should be bound to F1. The command itself is formatted as: {COMMAND-STRING, OUTPUT-BUFFER, use-small-footer-panel}. The first two options have already been described, the last, if set to true, lets you specify that you want the command executed in a small panel at the bottom of the window instead of taking over an entire panel.

And that is the entire project system so far!

Let me know if you have any thoughts on other features you would like to see that go along with projects.

Later everyone!
Mikkel ,
For us with the custom layer access, a key-value thing we could query would be awesome.
Dominik Madarász,
Is it possible to load files in folders recursively?

For example, I have some files in folder "code", which then contains another folders, etc.