ProjectDirectory to ProjectFolder

This commit is contained in:
Krzosa Karol
2026-02-03 21:11:02 +01:00
parent 930620a49e
commit 51f1fd1b4f
14 changed files with 30 additions and 30 deletions

View File

@@ -7,7 +7,7 @@
- Window position: vscode opens in fullscreen and then remembers what position it was close in (could be a config option) - Window position: vscode opens in fullscreen and then remembers what position it was close in (could be a config option)
- On Linux: Try to implement is_debugger_present() - On Linux: Try to implement is_debugger_present()
- Maybe IPC for te.exe when it's already open and file arguments are passed it should perhaps open a buffer in current window?? - Maybe IPC for te.exe when it's already open and file arguments are passed it should perhaps open a buffer in current window??
- Add <<File>> <<ProjectDirectory>> template strings to Open (Then remove SEtWorkdirhere) - Add <<File>> <<ProjectFolder>> template strings to Open (Then remove SEtWorkdirhere)
- :Set Filename to name current buffer ??? :O and others like that!! - :Set Filename to name current buffer ??? :O and others like that!!
- Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep) - Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep)
- Make the equivalent of SearchOpenBuffers but for cmds like !@git grep -n "@>" - Make the equivalent of SearchOpenBuffers but for cmds like !@git grep -n "@>"

View File

@@ -179,7 +179,7 @@ RegisterVariable(Int, TrimTrailingWhitespace, 1);
// PROJECT_MANAGEMENT // PROJECT_MANAGEMENT
// Set at the beginning of the program to current directory // Set at the beginning of the program to current directory
RegisterVariable(String, ProjectDirectory, ""); RegisterVariable(String, ProjectFolder, "");
// PLUGIN_BUILD_WINDOW // PLUGIN_BUILD_WINDOW
RegisterVariable(String, Build1OnWindows, "build.bat slow"); RegisterVariable(String, Build1OnWindows, "build.bat slow");

View File

@@ -5,7 +5,7 @@ BufferID BuildBufferID;
void InitBuildWindow() { void InitBuildWindow() {
Window *window = CreateWind(); Window *window = CreateWind();
BuildWindowID = window->id; BuildWindowID = window->id;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "build")); Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "build"));
buffer->special = true; buffer->special = true;
buffer->no_history = true; buffer->no_history = true;
BuildBufferID = buffer->id; BuildBufferID = buffer->id;
@@ -32,7 +32,7 @@ void LayoutBuildWindow(Rect2I *rect, int16_t wx, int16_t wy) {
window->document_rect = window->total_rect = CutBottom(rect, barsize); window->document_rect = window->total_rect = CutBottom(rect, barsize);
} }
BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = ProjectDirectory) { BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = ProjectFolder) {
SaveAll(); SaveAll();
Scratch scratch; Scratch scratch;
BSet build = GetBSet(BuildWindowID); BSet build = GetBSet(BuildWindowID);

View File

@@ -67,7 +67,7 @@ void LayoutCommandWindow(Rect2I *rect, int16_t wx, int16_t wy) {
void InitCommandWindow() { void InitCommandWindow() {
Window *window = CreateWind(); Window *window = CreateWind();
CommandWindowID = window->id; CommandWindowID = window->id;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "command_bar")); Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "command_bar"));
buffer->special = true; buffer->special = true;
buffer->no_history = true; buffer->no_history = true;
View *view = CreateView(buffer->id); View *view = CreateView(buffer->id);

View File

@@ -117,8 +117,8 @@ void Set(String string) {
} }
#if PLUGIN_PROJECT_MANAGEMENT #if PLUGIN_PROJECT_MANAGEMENT
if (name == "ProjectDirectory") { if (name == "ProjectFolder") {
SetProjectDirectory(*var->string); SetProjectFolder(*var->string);
} }
#endif #endif
return; return;

View File

@@ -12,7 +12,7 @@ void InitDebugWindow() {
window->primary = false; window->primary = false;
window->jump_history = false; window->jump_history = false;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "debug")); Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "debug"));
DebugBufferID = buffer->id; DebugBufferID = buffer->id;
buffer->no_history = true; buffer->no_history = true;
buffer->special = true; buffer->special = true;

View File

@@ -2,7 +2,7 @@ void Windows_SetupVCVarsall(mco_coro *co) {
View *view = NULL; View *view = NULL;
{ {
Scratch scratch; Scratch scratch;
String working_dir = ProjectDirectory; String working_dir = ProjectFolder;
String buffer_name = GetUniqueBufferName(working_dir, "vcvarsall-"); String buffer_name = GetUniqueBufferName(working_dir, "vcvarsall-");
String cmd = Format(scratch, "\"%S\" && set", VCVarsPath); String cmd = Format(scratch, "\"%S\" && set", VCVarsPath);
view = OpenBufferView(buffer_name); view = OpenBufferView(buffer_name);

View File

@@ -1,5 +1,5 @@
void SetProjectDirectory(String dir) { void SetProjectFolder(String dir) {
ProjectDirectory = Intern(&GlobalInternTable, dir); ProjectFolder = Intern(&GlobalInternTable, dir);
Scratch scratch; Scratch scratch;
For (Buffers) { For (Buffers) {
if (it->special) { if (it->special) {
@@ -14,7 +14,7 @@ void CO_OpenCode(mco_coro *co) {
Array<String> patterns = SplitWhitespace(ctx->arena, OpenCodePatterns); Array<String> patterns = SplitWhitespace(ctx->arena, OpenCodePatterns);
Array<String> exclude_patterns = SplitWhitespace(ctx->arena, OpenCodeExcludePatterns); Array<String> exclude_patterns = SplitWhitespace(ctx->arena, OpenCodeExcludePatterns);
Array<String> dirs = {ctx->arena}; Array<String> dirs = {ctx->arena};
Add(&dirs, Copy(ctx->arena, ProjectDirectory)); Add(&dirs, Copy(ctx->arena, ProjectFolder));
for (int diri = 0; diri < dirs.len; diri += 1) { for (int diri = 0; diri < dirs.len; diri += 1) {
for (FileIter it = IterateFiles(ctx->arena, dirs[diri]); IsValid(it); Advance(&it)) { for (FileIter it = IterateFiles(ctx->arena, dirs[diri]); IsValid(it); Advance(&it)) {
bool should_open = true; bool should_open = true;
@@ -52,12 +52,12 @@ void CO_OpenCode(mco_coro *co) {
} RegisterCoroutineCommand( } RegisterCoroutineCommand(
CO_OpenCode, CO_OpenCode,
"", "",
"Open all code files in current ProjectDirectory, the code files are determined through NonCodePatterns_EndsWith config variable list", "Open all code files in current ProjectFolder, the code files are determined through NonCodePatterns_EndsWith config variable list",
data->dont_wait_until_resolved = true; data->dont_wait_until_resolved = true;
); );
void OpenProject(String directory) { void OpenProject(String directory) {
SetProjectDirectory(directory); SetProjectFolder(directory);
#if PLUGIN_CONFIG #if PLUGIN_CONFIG
Scratch scratch; Scratch scratch;
for (FileIter it = IterateFiles(scratch, directory); IsValid(it); Advance(&it)) { for (FileIter it = IterateFiles(scratch, directory); IsValid(it); Advance(&it)) {
@@ -111,7 +111,7 @@ void CO_CreateProject(mco_coro *co) {
String src_dir = Format(scratch, "%S/src", project_dir); String src_dir = Format(scratch, "%S/src", project_dir);
MakeDir(project_dir); MakeDir(project_dir);
MakeDir(src_dir); MakeDir(src_dir);
SetProjectDirectory(project_dir); SetProjectFolder(project_dir);
Buffer *project = BufferOpenFile(Format(scratch, "%S/project.te", project_dir)); Buffer *project = BufferOpenFile(Format(scratch, "%S/project.te", project_dir));
RawAppendf(project, ":OpenCode\n:Set BinaryUnderDebug '%S/build/main.exe'\n", project_dir); RawAppendf(project, ":OpenCode\n:Set BinaryUnderDebug '%S/build/main.exe'\n", project_dir);

View File

@@ -1 +1 @@
void SetProjectDirectory(String name); void SetProjectFolder(String name);

View File

@@ -2124,7 +2124,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
if (file.len == 0) { if (file.len == 0) {
Scratch scratch; Scratch scratch;
for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) { for (FileIter it = IterateFiles(scratch, ProjectFolder); IsValid(it); Advance(&it)) {
if (EndsWith(it.filename, ".rdbg")) { if (EndsWith(it.filename, ".rdbg")) {
file = Intern(&GlobalInternTable, it.absolute_path); file = Intern(&GlobalInternTable, it.absolute_path);
break; break;
@@ -2178,7 +2178,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
rdbg_Id cfg_id; rdbg_Id cfg_id;
char *exe = file.data; char *exe = file.data;
char *args = NULL; char *args = NULL;
char *work_dir = ProjectDirectory.data; char *work_dir = ProjectFolder.data;
char *env = NULL; char *env = NULL;
AddSessionConfig(&RDBG_Ctx, exe, args, work_dir, env, true, true, &res, &cfg_id); AddSessionConfig(&RDBG_Ctx, exe, args, work_dir, env, true, true, &res, &cfg_id);
if (ContextHadError(&RDBG_Ctx)) { if (ContextHadError(&RDBG_Ctx)) {

View File

@@ -63,7 +63,7 @@ void CMD_ToggleSearchWordBoundary() {
void InitSearchWindow() { void InitSearchWindow() {
Window *window = CreateWind(); Window *window = CreateWind();
SearchWindowID = window->id; SearchWindowID = window->id;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "search")); Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "search"));
buffer->special = true; buffer->special = true;
SearchBufferID = buffer->id; SearchBufferID = buffer->id;
View *view = CreateView(buffer->id); View *view = CreateView(buffer->id);

View File

@@ -3,7 +3,7 @@ WindowID StatusWindowID;
void InitStatusWindow() { void InitStatusWindow() {
Window *window = CreateWind(); Window *window = CreateWind();
StatusWindowID = window->id; StatusWindowID = window->id;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectDirectory, "status_bar")); Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "status_bar"));
buffer->special = true; buffer->special = true;
View *view = CreateView(buffer->id); View *view = CreateView(buffer->id);
view->special = true; view->special = true;

View File

@@ -861,7 +861,7 @@ int main(int argc, char **argv)
#endif #endif
InitScratch(); InitScratch();
InitOS(ReportErrorf); InitOS(ReportErrorf);
ProjectDirectory = GetWorkingDir(Perm); ProjectFolder = GetWorkingDir(Perm);
#if OS_WINDOWS #if OS_WINDOWS
{ {
wchar_t *p = GetEnvironmentStringsW(); wchar_t *p = GetEnvironmentStringsW();
@@ -978,13 +978,13 @@ int main(int argc, char **argv)
{ {
Allocator sys_allocator = GetSystemAllocator(); Allocator sys_allocator = GetSystemAllocator();
Scratch scratch; Scratch scratch;
Buffer *null_buffer = CreateBuffer(sys_allocator, Format(scratch, "%S/scratch", ProjectDirectory)); Buffer *null_buffer = CreateBuffer(sys_allocator, Format(scratch, "%S/scratch", ProjectFolder));
null_buffer->special = true; null_buffer->special = true;
View *null_view = CreateView(null_buffer->id); View *null_view = CreateView(null_buffer->id);
null_view->special = true; null_view->special = true;
Assert(null_buffer->id == NullBufferID && null_view->id == NullViewID); Assert(null_buffer->id == NullBufferID && null_view->id == NullViewID);
Buffer *logs_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "logs", "")); Buffer *logs_buffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "logs", ""));
logs_buffer->special = true; logs_buffer->special = true;
View *logs_view = CreateView(logs_buffer->id); View *logs_view = CreateView(logs_buffer->id);
logs_view->special = true; logs_view->special = true;
@@ -992,13 +992,13 @@ int main(int argc, char **argv)
LogView = logs_view; LogView = logs_view;
#if PLUGIN_RECORD_GC #if PLUGIN_RECORD_GC
GCInfoBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "gc")); GCInfoBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "gc"));
GCInfoBuffer->special = true; GCInfoBuffer->special = true;
GCInfoBuffer->no_history = true; GCInfoBuffer->no_history = true;
#endif #endif
#if PLUGIN_RECORD_EVENTS #if PLUGIN_RECORD_EVENTS
EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectDirectory, "events")); EventBuffer = CreateBuffer(sys_allocator, GetUniqueBufferName(ProjectFolder, "events"));
EventBuffer->no_history = true; EventBuffer->no_history = true;
EventBuffer->special = true; EventBuffer->special = true;
#endif #endif

View File

@@ -291,8 +291,8 @@ String InsertVariables(Allocator allocator, String string) {
void TestInsertVariable() { void TestInsertVariable() {
Scratch scratch; Scratch scratch;
String a = "Thing/@(ProjectDirectory)/Another"; String a = "Thing/@(ProjectFolder)/Another";
String b = "Thing/@ProjectDirectory/Another"; String b = "Thing/@ProjectFolder/Another";
Assert(InsertVariables(scratch, a) == InsertVariables(scratch, b)); Assert(InsertVariables(scratch, a) == InsertVariables(scratch, b));
int c = 10; int c = 10;
@@ -301,8 +301,8 @@ void TestInsertVariable() {
/* /*
Variables: Variables:
@ProjectDirectory/build/te @ProjectFolder/build/te
@(ProjectDirectory)/build/te @(ProjectFolder)/build/te
Start of string matchers: Start of string matchers:
! Execute with default shell ! Execute with default shell
@@ -315,7 +315,7 @@ Start of string matchers:
py: @todo, execute in python shell, this will use the python3 shell and pass the rest to it's stdin or maybe as a file py: @todo, execute in python shell, this will use the python3 shell and pass the rest to it's stdin or maybe as a file
More comprehensive syntax for commands: More comprehensive syntax for commands:
!{/usr/bin/python,Hidden,Input:Clipboard,Output:Clipboard,WorkingDirectory:@ProjectDirectory,Env:{Thing:asd}} !{/usr/bin/python,Hidden,Input:Clipboard,Output:Clipboard,WorkingDirectory:@ProjectFolder,Env:{Thing:asd}}
Otherwise it does filepath parsing: Otherwise it does filepath parsing:
C:/windows/path C:/windows/path