diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-06-15 22:12:03 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-06-15 22:12:03 +0000 |
commit | de625be3c9a199bd369d8f9a89842578d84dcb4a (patch) | |
tree | 066a4421cebbcd0a4aae271fdf785c83de16d406 /pages | |
parent | b9a26f614d8eee40b6caca4eb008ce14f0a80f24 (diff) | |
download | vdr-plugin-live-de625be3c9a199bd369d8f9a89842578d84dcb4a.tar.gz vdr-plugin-live-de625be3c9a199bd369d8f9a89842578d84dcb4a.tar.bz2 |
- Use stat to find the directories that are assumed to be themes for
live. This fixes #353.
Diffstat (limited to 'pages')
-rw-r--r-- | pages/setup.ecpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pages/setup.ecpp b/pages/setup.ecpp index 008bec3..46ccf66 100644 --- a/pages/setup.ecpp +++ b/pages/setup.ecpp @@ -1,4 +1,5 @@ <%pre> +#include <sys/stat.h> #include <vdr/tools.h> #include "setup.h" #include "tools.h" @@ -156,7 +157,8 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <td class="rightcol"><select name="theme" size="1" id="theme"> <%cpp> { - cReadDir d((Plugin::GetConfigDirectory() + "/themes").c_str()); + const string dirPath(Plugin::GetConfigDirectory() + "/themes"); + cReadDir d(dirPath.c_str()); struct dirent* e; string parent(".."); string current("."); @@ -164,7 +166,13 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); if ((current == e->d_name) || (parent == e->d_name)) { continue; } - if (DT_DIR != e->d_type) { + /* Check if entry is a directory: I do not rely on e->d_type + here because on some systems it is allways DT_UNKNOWN. Also + testing for DT_DIR does not take into account symbolic + links to directories. + */ + struct stat buf; + if ((stat((dirPath + "/" + e->d_name).c_str(), &buf) != 0) || (!S_ISDIR(buf.st_mode))) { continue; } </%cpp> |