From fef6c54b5df966789259c35892f588fdefd3b27c Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 26 Apr 2023 17:20:35 +1200 Subject: [PATCH] Open projects dir in explorer --- src/platform/linux.jai | 4 ++++ src/platform/macos.jai | 4 ++++ src/platform/windows.jai | 6 ++++++ src/widgets/commands.jai | 1 + 4 files changed, 15 insertions(+) diff --git a/src/platform/linux.jai b/src/platform/linux.jai index 21b09901c..afc8edd56 100644 --- a/src/platform/linux.jai +++ b/src/platform/linux.jai @@ -53,6 +53,10 @@ platform_get_fonts_dir :: () -> string { return "/usr/share/fonts"; } +platform_open_in_explorer :: (dir: string) { + unimplemented(); +} + #scope_file Monitor :: struct { diff --git a/src/platform/macos.jai b/src/platform/macos.jai index b361620c4..7690b3cd3 100644 --- a/src/platform/macos.jai +++ b/src/platform/macos.jai @@ -54,6 +54,10 @@ platform_get_fonts_dir :: () -> string { return "/Library/Fonts"; } +platform_open_in_explorer :: (dir: string) { + // unimplemented(); +} + #scope_file Monitor :: struct { diff --git a/src/platform/windows.jai b/src/platform/windows.jai index 66548c89e..d5cd1aea0 100644 --- a/src/platform/windows.jai +++ b/src/platform/windows.jai @@ -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 { @@ -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"; diff --git a/src/widgets/commands.jai b/src/widgets/commands.jai index e0276e395..e03ae1413 100644 --- a/src/widgets/commands.jai +++ b/src/widgets/commands.jai @@ -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;