Add shared_folder INI option.
This commit is contained in:
@@ -119,3 +119,9 @@ sniper_mode=0
|
||||
|
||||
; 0 - disable MiSTer logo in Menu core
|
||||
logo=1
|
||||
|
||||
; Custom shared folder for core supporting this feature (currently minimig only)
|
||||
; Can be relative to core's home dir or absolute path.
|
||||
; Path must exist before core start to use it, or it will fail.
|
||||
; Make sure USB device is mounted before use shared folder on USB!
|
||||
shared_folder=
|
||||
|
||||
1
cfg.cpp
1
cfg.cpp
@@ -71,6 +71,7 @@ static const ini_var_t ini_vars[] =
|
||||
{ "SNIPER_MODE", (void*)(&(cfg.sniper_mode)), UINT8, 0, 1 },
|
||||
{ "BROWSE_EXPAND", (void*)(&(cfg.browse_expand)), UINT8, 0, 1 },
|
||||
{ "LOGO", (void*)(&(cfg.logo)), UINT8, 0, 1 },
|
||||
{ "SHARED_FOLDER", (void*)(&(cfg.shared_folder)), STRING, 0, sizeof(cfg.shared_folder) - 1 },
|
||||
};
|
||||
|
||||
static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t));
|
||||
|
||||
1
cfg.h
1
cfg.h
@@ -50,6 +50,7 @@ typedef struct {
|
||||
char video_conf_pal[1024];
|
||||
char video_conf_ntsc[1024];
|
||||
char font[1024];
|
||||
char shared_folder[1024];
|
||||
} cfg_t;
|
||||
|
||||
extern cfg_t cfg;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "../../file_io.h"
|
||||
#include "../../user_io.h"
|
||||
#include "../../spi.h"
|
||||
#include "../../cfg.h"
|
||||
#include "miminig_fs_messages.h"
|
||||
|
||||
#define SHMEM_ADDR 0x27FF4000
|
||||
@@ -235,12 +236,35 @@ static int process_request(void *reqres_buffer)
|
||||
|
||||
if (!baselen)
|
||||
{
|
||||
strcpy(basepath, HomeDir());
|
||||
strcat(basepath, "/shared");
|
||||
if (strlen(cfg.shared_folder))
|
||||
{
|
||||
if(cfg.shared_folder[0] == '/') strcpy(basepath, cfg.shared_folder);
|
||||
else
|
||||
{
|
||||
strcpy(basepath, HomeDir());
|
||||
strcat(basepath, "/");
|
||||
strcat(basepath, cfg.shared_folder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(basepath, HomeDir());
|
||||
strcat(basepath, "/shared");
|
||||
}
|
||||
|
||||
baselen = strlen(basepath);
|
||||
FileCreatePath(basepath);
|
||||
if (baselen && basepath[baselen - 1] == '/')
|
||||
{
|
||||
basepath[baselen - 1] = 0;
|
||||
baselen--;
|
||||
}
|
||||
|
||||
if(baselen) FileCreatePath(basepath);
|
||||
}
|
||||
|
||||
// no base path => force fail
|
||||
if (!baselen) rtype = ACTION_NIL;
|
||||
|
||||
switch (rtype)
|
||||
{
|
||||
case ACTION_LOCATE_OBJECT:
|
||||
|
||||
Reference in New Issue
Block a user