@@ -2028,7 +2028,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
2028
2028
DF_PathQuery path_query = df_path_query_from_string (query_normalized_with_opt_slash );
2029
2029
F32 row_height_px = floor_f32 (ui_top_font_size ()* 2.5f );
2030
2030
F32 scroll_bar_dim = floor_f32 (ui_top_font_size ()* 1.5f );
2031
- B32 dir_selection = 0 ;
2031
+ B32 dir_selection = !!( ws -> query_cmd_spec -> info . query . flags & DF_CmdQueryFlag_FoldersOnly ) ;
2032
2032
2033
2033
//- rjf: get extra state for this view
2034
2034
DF_FileSystemViewState * fs = df_view_user_state (view , DF_FileSystemViewState );
@@ -2209,6 +2209,15 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
2209
2209
}
2210
2210
}
2211
2211
2212
+ // rjf: command argument is empty, picking folders -> use current folder
2213
+ else if (path_query .search .size == 0 && dir_selection )
2214
+ {
2215
+ DF_CmdParams params = df_cmd_params_from_view (ws , panel , view );
2216
+ params .file_path = path_query .path ;
2217
+ df_cmd_params_mark_slot (& params , DF_CmdParamSlot_FilePath );
2218
+ df_push_cmd__root (& params , df_cmd_spec_from_core_cmd_kind (DF_CoreCmdKind_CompleteQuery ));
2219
+ }
2220
+
2212
2221
// rjf: command argument does not exactly match any file, but lister results are in:
2213
2222
else if (file_count != 0 )
2214
2223
{
@@ -2796,6 +2805,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Target)
2796
2805
{
2797
2806
default :break ;
2798
2807
case DF_CoreCmdKind_PickFile :
2808
+ case DF_CoreCmdKind_PickFolder :
2799
2809
{
2800
2810
String8 pick_string = cmd -> params .file_path ;
2801
2811
DF_Entity * storage_entity = entity ;
@@ -2835,18 +2845,19 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
2835
2845
struct
2836
2846
{
2837
2847
B32 fill_with_file ;
2848
+ B32 fill_with_folder ;
2838
2849
B32 use_code_font ;
2839
2850
String8 key ;
2840
2851
DF_EntityKind storage_child_kind ;
2841
2852
String8 current_text ;
2842
2853
}
2843
2854
kv_info [] =
2844
2855
{
2845
- { 0 , 0 , str8_lit ("Label" ), DF_EntityKind_Nil , entity -> name },
2846
- { 1 , 0 , str8_lit ("Executable" ), DF_EntityKind_Executable , df_entity_child_from_kind (entity , DF_EntityKind_Executable )-> name },
2847
- { 0 , 0 , str8_lit ("Arguments" ), DF_EntityKind_Arguments , df_entity_child_from_kind (entity , DF_EntityKind_Arguments )-> name },
2848
- { 1 , 0 , str8_lit ("Working Directory" ), DF_EntityKind_ExecutionPath , df_entity_child_from_kind (entity , DF_EntityKind_ExecutionPath )-> name },
2849
- { 0 , 1 , str8_lit ("Entry Point Override" ), DF_EntityKind_EntryPointName , df_entity_child_from_kind (entity , DF_EntityKind_EntryPointName )-> name },
2856
+ { 0 , 0 , 0 , str8_lit ("Label" ), DF_EntityKind_Nil , entity -> name },
2857
+ { 1 , 0 , 0 , str8_lit ("Executable" ), DF_EntityKind_Executable , df_entity_child_from_kind (entity , DF_EntityKind_Executable )-> name },
2858
+ { 0 , 0 , 0 , str8_lit ("Arguments" ), DF_EntityKind_Arguments , df_entity_child_from_kind (entity , DF_EntityKind_Arguments )-> name },
2859
+ { 0 , 1 , 0 , str8_lit ("Working Directory" ), DF_EntityKind_ExecutionPath , df_entity_child_from_kind (entity , DF_EntityKind_ExecutionPath )-> name },
2860
+ { 0 , 0 , 1 , str8_lit ("Entry Point Override" ), DF_EntityKind_EntryPointName , df_entity_child_from_kind (entity , DF_EntityKind_EntryPointName )-> name },
2850
2861
};
2851
2862
2852
2863
//- rjf: take controls to start/end editing
@@ -2922,7 +2933,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
2922
2933
UI_TableVector
2923
2934
{
2924
2935
B32 row_selected = (tv -> cursor .y == idx + 1 );
2925
- B32 has_browse = kv_info [idx ].fill_with_file ;
2936
+ B32 has_browse = kv_info [idx ].fill_with_file || kv_info [ idx ]. fill_with_folder ;
2926
2937
2927
2938
//- rjf: key (label)
2928
2939
UI_TableCell UI_TextColor (df_rgba_from_theme_color (DF_ThemeColor_WeakText ))
@@ -3027,7 +3038,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
3027
3038
if (ui_buttonf ("Browse ...").clicked )
3028
3039
{
3029
3040
DF_CmdParams params = df_cmd_params_from_view (ws , panel , view );
3030
- params .cmd_spec = df_cmd_spec_from_core_cmd_kind (DF_CoreCmdKind_PickFile );
3041
+ params .cmd_spec = df_cmd_spec_from_core_cmd_kind (kv_info [ idx ]. fill_with_file ? DF_CoreCmdKind_PickFile : DF_CoreCmdKind_PickFolder );
3031
3042
df_cmd_params_mark_slot (& params , DF_CmdParamSlot_CmdSpec );
3032
3043
df_push_cmd__root (& params , df_cmd_spec_from_core_cmd_kind (DF_CoreCmdKind_RunCommand ));
3033
3044
tv -> pick_dst_kind = kv_info [idx ].storage_child_kind ;
0 commit comments