Correct path to default NVR files on Linux
This commit is contained in:
parent
2e037b5076
commit
5f772fdf70
4 changed files with 21 additions and 5 deletions
|
|
@ -48,11 +48,7 @@ FILE *nvrfopen(char *fn, char *mode)
|
|||
|
||||
if (mode[0] == 'r')
|
||||
{
|
||||
strcpy(s, nvr_path);
|
||||
put_backslash(s);
|
||||
strcat(s, "default");
|
||||
put_backslash(s);
|
||||
strcat(s, fn);
|
||||
snprintf(s, 512, "%s%s", nvr_default_path, fn);
|
||||
return fopen(s, mode);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
12
src/paths.c
12
src/paths.c
|
|
@ -25,6 +25,8 @@ char logs_path[512];
|
|||
/* this is where screenshots as stored */
|
||||
char screenshots_path[512];
|
||||
|
||||
char nvr_default_path[512];
|
||||
|
||||
char get_path_separator()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -129,6 +131,11 @@ void set_default_nvr_path(char *s)
|
|||
set_nvr_path(s);
|
||||
}
|
||||
|
||||
static void set_default_nvr_default_path(char *s)
|
||||
{
|
||||
safe_strncpy(nvr_default_path, s, 512);
|
||||
}
|
||||
|
||||
/* set the default logs path, this makes it permanent */
|
||||
void set_default_logs_path(char *s)
|
||||
{
|
||||
|
|
@ -203,6 +210,7 @@ void paths_onconfigloaded()
|
|||
void paths_init()
|
||||
{
|
||||
char s[512];
|
||||
char base_path[512];
|
||||
char *p;
|
||||
|
||||
get_pcem_path(pcem_path, 512);
|
||||
|
|
@ -221,6 +229,10 @@ void paths_init()
|
|||
set_screenshots_path(s);
|
||||
set_logs_path(pcem_path);
|
||||
|
||||
get_pcem_base_path(base_path, 512);
|
||||
append_filename(s, base_path, "nvr/default/", 512);
|
||||
set_default_nvr_default_path(s);
|
||||
|
||||
add_config_callback(paths_loadconfig, paths_saveconfig, paths_onconfigloaded);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ extern char configs_path[512];
|
|||
extern char nvr_path[512];
|
||||
extern char logs_path[512];
|
||||
extern char screenshots_path[512];
|
||||
extern char nvr_default_path[512];
|
||||
|
||||
void get_pcem_path(char *s, int size);
|
||||
void get_pcem_base_path(char *s, int size);
|
||||
char get_path_separator();
|
||||
void paths_init();
|
||||
int dir_exists(char* path);
|
||||
|
|
|
|||
|
|
@ -263,6 +263,12 @@ void get_pcem_path(char *s, int size)
|
|||
#endif
|
||||
}
|
||||
|
||||
void get_pcem_base_path(char *s, int size)
|
||||
{
|
||||
char* path = SDL_GetBasePath();
|
||||
strcpy(s, path);
|
||||
}
|
||||
|
||||
void set_window_title(const char *s)
|
||||
{
|
||||
sdl_set_window_title(s);
|
||||
|
|
|
|||
Loading…
Reference in a new issue