mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-20 21:10:16 -08:00
split shell operation abstraction from graphical window manager abstraction - do basic integration of common linux utilities for implementing shell operations - also add 'sh_install_or_uninstall_self' for doing shell-specific operations related to installing or uninstalling an application. hook up to config state in raddbg
This commit is contained in:
1 parent
32ef9095e0
commit
867b64f7a2
26 files changed
+551
-201
No files matched your search
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @per_os_impl Shell Operations
|
||||
|
||||
internal void
|
||||
sh_message(B32 error, String8 title, String8 message)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String16 title16 = str16_from_8(scratch.arena, title);
|
||||
String16 message16 = str16_from_8(scratch.arena, message);
|
||||
MessageBoxW(0, (WCHAR *)message16.str, (WCHAR *)title16.str, MB_OK|(!!error*MB_ICONERROR));
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal String8
|
||||
sh_pick_file(Arena *arena, String8 title, String8 initial_path)
|
||||
{
|
||||
String8 result = {0};
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
U64 buffer_size = 4096;
|
||||
U16 *buffer = push_array(scratch.arena, U16, buffer_size);
|
||||
OPENFILENAMEW params = {sizeof(params)};
|
||||
{
|
||||
params.lpstrTitle = (WCHAR *)str16_from_8(scratch.arena, title).str;
|
||||
params.lpstrFile = (WCHAR *)buffer;
|
||||
params.nMaxFile = buffer_size;
|
||||
params.lpstrInitialDir = (WCHAR *)str16_from_8(scratch.arena, initial_path).str;
|
||||
}
|
||||
if(GetOpenFileNameW(¶ms))
|
||||
{
|
||||
result = str8_from_16(arena, str16_cstring((U16 *)buffer));
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
sh_show_in_file_browser(String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 path_copy = push_str8_copy(scratch.arena, path);
|
||||
for(U64 idx = 0; idx < path_copy.size; idx += 1)
|
||||
{
|
||||
if(path_copy.str[idx] == '/')
|
||||
{
|
||||
path_copy.str[idx] = '\\';
|
||||
}
|
||||
}
|
||||
String16 path16 = str16_from_8(scratch.arena, path_copy);
|
||||
SFGAOF flags = 0;
|
||||
PIDLIST_ABSOLUTE list = 0;
|
||||
if(path16.size != 0 && SUCCEEDED(SHParseDisplayName(path16.str, 0, &list, 0, &flags)))
|
||||
{
|
||||
HRESULT hr = SHOpenFolderAndSelectItems(list, 0, 0, 0);
|
||||
CoTaskMemFree(list);
|
||||
(void)hr;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
sh_open_in_browser(String8 url)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String16 url16 = str16_from_8(scratch.arena, url);
|
||||
ShellExecuteW(0, L"open", (WCHAR *)url16.str, 0, 0, SW_SHOWNORMAL);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
sh_install_or_uninstall_self(B32 install)
|
||||
{
|
||||
// TODO(rjf)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef WIN32_SHELL_H
|
||||
#define WIN32_SHELL_H
|
||||
|
||||
#endif // WIN32_SHELL_H
|
||||
Reference in new issue
Block a user