Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

Commit fb4d181

Browse files
author
Allen Webster
committed
override user directory on command line
1 parent e3efa89 commit fb4d181

File tree

8 files changed

+655
-625
lines changed

8 files changed

+655
-625
lines changed

4ed.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
5252

5353
case 'f': action = CLAct_FontSize; break;
5454
case 'h': action = CLAct_FontUseHinting; --i; break;
55+
case 'U': action = CLAct_UserDirectory; break;
5556
}
5657
}
5758
else if (arg[0] != 0){
@@ -137,6 +138,14 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
137138
settings->use_hinting = plat_settings->use_hinting;
138139
action = CLAct_Nothing;
139140
}break;
141+
142+
case CLAct_UserDirectory:
143+
{
144+
if (i < argc){
145+
plat_settings->user_directory = argv[i];
146+
}
147+
action = CLAct_Nothing;
148+
}break;
140149
}
141150
}break;
142151

4ed.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ struct Plat_Settings{
2828
b8 maximize_window;
2929

3030
b8 use_hinting;
31+
32+
char *user_directory;
3133
};
3234

3335
#define App_Read_Command_Line_Sig(name) \
3436
void *name(Thread_Context *tctx,\
35-
String_Const_u8 current_directory,\
36-
Plat_Settings *plat_settings,\
37-
char ***files, \
38-
i32 **file_count,\
39-
i32 argc, \
40-
char **argv)
37+
String_Const_u8 current_directory,\
38+
Plat_Settings *plat_settings,\
39+
char ***files, \
40+
i32 **file_count,\
41+
i32 argc, \
42+
char **argv)
4143

4244
typedef App_Read_Command_Line_Sig(App_Read_Command_Line);
4345

@@ -48,10 +50,10 @@ struct Custom_API{
4850

4951
#define App_Init_Sig(name) \
5052
void name(Thread_Context *tctx, \
51-
Render_Target *target, \
52-
void *base_ptr, \
53-
String_Const_u8 current_directory,\
54-
Custom_API api)
53+
Render_Target *target, \
54+
void *base_ptr, \
55+
String_Const_u8 current_directory,\
56+
Custom_API api)
5557

5658
typedef App_Init_Sig(App_Init);
5759

@@ -77,9 +79,9 @@ struct Application_Step_Input{
7779

7880
#define App_Step_Sig(name) Application_Step_Result \
7981
name(Thread_Context *tctx, \
80-
Render_Target *target, \
81-
void *base_ptr, \
82-
Application_Step_Input *input)
82+
Render_Target *target, \
83+
void *base_ptr, \
84+
Application_Step_Input *input)
8385

8486
typedef App_Step_Sig(App_Step);
8587

4ed_app_models.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ struct File_Init{
180180
enum Command_Line_Action{
181181
CLAct_Nothing,
182182
CLAct_Ignore,
183-
CLAct_UserFile,
184183
CLAct_CustomDLL,
185184
CLAct_WindowSize,
186185
CLAct_WindowMaximize,
187186
CLAct_WindowPosition,
188187
CLAct_WindowFullscreen,
189188
CLAct_FontSize,
190189
CLAct_FontUseHinting,
190+
CLAct_UserDirectory,
191191
//
192192
CLAct_COUNT,
193193
};

4ed_file.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@ save_file_to_name(Thread_Context *tctx, Models *models, Editing_File *file, u8 *
167167
return(result);
168168
}
169169

170-
internal b32
171-
save_file(Thread_Context *tctx, Models *models, Editing_File *file){
172-
return(save_file_to_name(tctx, models, file, 0));
173-
}
174-
175170
////////////////////////////////
176171

177172
internal Buffer_Cursor

platform_linux/linux_4ed.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,11 @@ main(int argc, char **argv){
18351835
}*/
18361836
}
18371837

1838+
// NOTE(allen): setup user directory override
1839+
if (plat_settings.user_directory != 0){
1840+
lnx_override_user_directory = plat_settings.user_directory;
1841+
}
1842+
18381843
// NOTE(allen): load custom layer
18391844
System_Library custom_library = {};
18401845
Custom_API custom = {};

0 commit comments

Comments
 (0)