Minor mod to wd and hts settings to allow abs paths to be passed to hts_settings_load().
This commit is contained in:
parent
dcbcf4fe35
commit
0b0012476d
2 changed files with 19 additions and 5 deletions
|
@ -206,20 +206,24 @@ hts_settings_load_one(const char *filename)
|
|||
static int
|
||||
hts_settings_buildpath(char *dst, size_t dstsize, const char *fmt, va_list ap)
|
||||
{
|
||||
char tmp[256];
|
||||
char *n = dst;
|
||||
|
||||
if(settingspath == NULL)
|
||||
return -1;
|
||||
|
||||
snprintf(dst, dstsize, "%s/", settingspath);
|
||||
|
||||
vsnprintf(dst + strlen(dst), dstsize - strlen(dst), fmt, ap);
|
||||
|
||||
vsnprintf(tmp, sizeof(tmp), fmt, ap);
|
||||
if (*tmp != '/')
|
||||
snprintf(dst, dstsize, "%s/%s", settingspath, tmp);
|
||||
else
|
||||
strncpy(dst, tmp, dstsize);
|
||||
|
||||
while(*n) {
|
||||
if(*n == ':' || *n == '?' || *n == '*' || *n > 127 || *n < 32)
|
||||
*n = '_';
|
||||
n++;
|
||||
}
|
||||
printf("hts_settings_buildpath(): %s => %s\n", fmt, dst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
const char *tvheadend_dataroot(void)
|
||||
{
|
||||
return "./";
|
||||
static char cwd[256] = { 0 };
|
||||
if (!*cwd) {
|
||||
assert(getcwd(cwd, 254));
|
||||
strcat(cwd, "/");
|
||||
}
|
||||
printf("cwd = %s\n", cwd);
|
||||
return cwd;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue