Skip to content

Commit

Permalink
Open projects dir in explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
focus-editor committed Apr 26, 2023
1 parent 55da123 commit fef6c54
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/platform/linux.jai
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ platform_get_fonts_dir :: () -> string {
return "/usr/share/fonts";
}

platform_open_in_explorer :: (dir: string) {
unimplemented();
}

#scope_file

Monitor :: struct {
Expand Down
4 changes: 4 additions & 0 deletions src/platform/macos.jai
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ platform_get_fonts_dir :: () -> string {
return "/Library/Fonts";
}

platform_open_in_explorer :: (dir: string) {
// unimplemented();
}

#scope_file

Monitor :: struct {
Expand Down
6 changes: 6 additions & 0 deletions src/platform/windows.jai
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ platform_get_fonts_dir :: () -> string {
return "C:/Windows/Fonts";
}

platform_open_in_explorer :: (dir: string) {
ShellExecuteW(window, utf8_to_wide("explore"), utf8_to_wide(dir), xx 0, xx 0, SW_NORMAL);
}

#scope_file

monitor_enum_proc :: (hMonitor: HMONITOR, hdc: HDC, rect: *RECT, data: LPARAM) -> BOOL #c_call {
Expand Down Expand Up @@ -135,11 +139,13 @@ REFRESH_TIMER_ID :: 0;

user32 :: #system_library "user32";
kernel32 :: #system_library "kernel32";
shell32 :: #system_library "shell32";

WaitMessage :: () -> s32 #foreign user32;
SetTimer :: (hWnd: HWND, nIDEvent: u64, uElapse: u32, lpTimerFunc: *void) -> s32 #foreign user32;
KillTimer :: (hWnd: HWND, nIDEvent: u64) -> bool #foreign user32;
GetDpiForWindow :: (hWnd: HWND) -> u32 #foreign user32;
GetLogicalDriveStringsW :: (nBufferLength: DWORD, lpBuffer: *u16) -> DWORD #foreign kernel32;
ShellExecuteW :: (hwnd: HWND, lpOperation: *u16, lpFile: *u16, lpParameters: *u16, lpDirectory: *u16, nShowCmd: int) -> s32 #foreign shell32;

#import "Windows";
1 change: 1 addition & 0 deletions src/widgets/commands.jai
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ commands_execute_selected :: () {
case .do_nothing; return;

case .open_projects_directory;
platform_open_in_explorer(projects_dir);
case .open_global_config;
case .open_project_config;
case .switch_project;
Expand Down

0 comments on commit fef6c54

Please sign in to comment.