Project configs

This commit is contained in:
Krzosa Karol
2026-01-05 11:54:10 +01:00
parent 233ebe0eba
commit 96d9847639
6 changed files with 102 additions and 90 deletions

View File

@@ -896,26 +896,21 @@ int main(int argc, char **argv)
}
}
String project_config = {};
for (int i = 1; i < argc; i += 1) {
String it = argv[i];
if (EndsWith(it, ".te")) {
project_config = it;
}
Open(argv[i]);
}
{
Scratch scratch;
String exe_dir = GetExeDir(scratch);
String config_path = Format(scratch, "%S/config.te", exe_dir);
Window *window = GetWindow(NullWindowID);
View *view = WindowOpenBufferView(window, config_path);
Buffer *buffer = GetBuffer(view->active_buffer);
buffer->special = true;
GlobalConfigBufferID = buffer->id;
EvalCommandsLineByLine({window, view, buffer});
if (window->active_view == view->id) {
window->active_view = NullViewID;
}
Scratch scratch;
GlobalConfigBufferID = LoadConfig(Format(scratch, "%S/config.te", GetExeDir(scratch)));
if (project_config.len) {
LoadConfig(project_config);
}
ReportConsolef(":Set WorkDir '%S'", WorkDir);
if (Testing) InitTests();
#if OS_WINDOWS