fix and use THEMESDIR variable; move THEMESDIR_VAR to global.h

Origin commit data
------------------
Branch: ni/coolstream
Commit: 51e77c3fc6
Author: vanhofen <vanhofen@gmx.de>
Date: 2015-05-06 (Wed, 06 May 2015)

Origin message was:
------------------
- fix and use THEMESDIR variable; move THEMESDIR_VAR to global.h

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2015-05-06 10:32:49 +02:00
parent d36bcb1609
commit a15970a07e
4 changed files with 17 additions and 17 deletions

View File

@@ -147,7 +147,7 @@ TUXBOX_APPS_DIRECTORY_ONE(ucodedir,UCODEDIR,localstatedir,/var,/tuxbox/ucodes,
[--with-ucodedir=PATH ],[where to find the ucodes]) [--with-ucodedir=PATH ],[where to find the ucodes])
TUXBOX_APPS_DIRECTORY_ONE(themesdir,THEMESDIR,datadir,/share, /tuxbox/neutrino/themes, TUXBOX_APPS_DIRECTORY_ONE(themesdir,THEMESDIR,datadir,/share, /tuxbox/neutrino/themes,
[--with-themesdir=PATH ],[where to find the themes (don't change)]) [--with-themesdir=PATH ],[where to find the themes])
TUXBOX_APPS_DIRECTORY_ONE(iconsdir,ICONSDIR,datadir,/share, /tuxbox/neutrino/icons, TUXBOX_APPS_DIRECTORY_ONE(iconsdir,ICONSDIR,datadir,/share, /tuxbox/neutrino/icons,
[--with-iconsdir=PATH ],[where to find the icons (don't change)]) [--with-iconsdir=PATH ],[where to find the icons (don't change)])

View File

@@ -1,4 +1,4 @@
installdir = $(DATADIR)/neutrino/themes installdir = $(THEMESDIR)
install_DATA = \ install_DATA = \
Classic.theme \ Classic.theme \

View File

@@ -46,6 +46,8 @@
#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf"
#define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked" #define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked"
#define THEMESDIR_VAR "/var/tuxbox/themes"
NEUTRINO_CPP SNeutrinoSettings g_settings; NEUTRINO_CPP SNeutrinoSettings g_settings;
NEUTRINO_CPP SglobalInfo g_info; NEUTRINO_CPP SglobalInfo g_info;

View File

@@ -50,9 +50,7 @@
#include "themes.h" #include "themes.h"
#define THEMEDIR DATADIR "/neutrino/themes/" #define USERDIR "/var" THEMESDIR
#define THEMEDIR_VAR "/var/tuxbox/themes/"
#define USERDIR "/var" THEMEDIR
#define FILE_PREFIX ".theme" #define FILE_PREFIX ".theme"
CThemes::CThemes() CThemes::CThemes()
@@ -82,10 +80,10 @@ int CThemes::exec(CMenuTarget* parent, const std::string & actionKey)
if ( strstr(themeFile.c_str(), "{U}") != 0 ) if ( strstr(themeFile.c_str(), "{U}") != 0 )
{ {
themeFile.erase(0, 3); themeFile.erase(0, 3);
readFile(((std::string)THEMEDIR_VAR + themeFile + FILE_PREFIX).c_str()); readFile(((std::string)THEMESDIR_VAR + "/" + themeFile + FILE_PREFIX).c_str());
} }
else else
readFile(((std::string)THEMEDIR + themeFile + FILE_PREFIX).c_str()); readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_PREFIX).c_str());
} }
return res; return res;
} }
@@ -104,7 +102,7 @@ void CThemes::readThemes(CMenuWidget &themes)
{ {
struct dirent **themelist; struct dirent **themelist;
int n; int n;
const char *pfade[] = {THEMEDIR, THEMEDIR_VAR}; const char *pfade[] = {THEMESDIR, THEMESDIR_VAR};
bool hasCVSThemes, hasUserThemes; bool hasCVSThemes, hasUserThemes;
hasCVSThemes = hasUserThemes = false; hasCVSThemes = hasUserThemes = false;
std::string userThemeFile = ""; std::string userThemeFile = "";
@@ -163,22 +161,22 @@ int CThemes::Show()
CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name);
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green);
if (CFileHelpers::createDir(THEMEDIR_VAR) && errno != EEXIST) { if (CFileHelpers::createDir(THEMESDIR_VAR) && errno != EEXIST) {
printf("[neutrino theme] error creating %s\n", THEMEDIR_VAR); printf("[neutrino theme] error creating %s\n", THEMESDIR_VAR);
} }
if (access(THEMEDIR_VAR, F_OK) == 0 ) { if (access(THEMESDIR_VAR, F_OK) == 0 ) {
themes.addItem(GenericMenuSeparatorLine); themes.addItem(GenericMenuSeparatorLine);
themes.addItem(m1); themes.addItem(m1);
} else { } else {
delete m1; delete m1;
printf("[neutrino theme] error accessing %s\n", THEMEDIR_VAR); printf("[neutrino theme] error accessing %s\n", THEMESDIR_VAR);
} }
int res = themes.exec(NULL, ""); int res = themes.exec(NULL, "");
if (!file_name.empty()) { if (!file_name.empty()) {
saveFile(((std::string)THEMEDIR_VAR + file_name + FILE_PREFIX).c_str()); saveFile(((std::string)THEMESDIR_VAR + "/" + file_name + FILE_PREFIX).c_str());
} }
if (hasThemeChanged) { if (hasThemeChanged) {
@@ -357,9 +355,9 @@ void CThemes::move_userDir()
{ {
if (access(USERDIR, F_OK) == 0) if (access(USERDIR, F_OK) == 0)
{ {
if (CFileHelpers::createDir(THEMEDIR_VAR) && errno != EEXIST) if (CFileHelpers::createDir(THEMESDIR_VAR) && errno != EEXIST)
{ {
printf("[neutrino theme] error creating %s\n", THEMEDIR_VAR); printf("[neutrino theme] error creating %s\n", THEMESDIR_VAR);
return; return;
} }
struct dirent **themelist; struct dirent **themelist;
@@ -376,8 +374,8 @@ void CThemes::move_userDir()
const char *file = themelist[count]->d_name; const char *file = themelist[count]->d_name;
if (strcmp(file, ".") == 0 || strcmp(file, "..") == 0) if (strcmp(file, ".") == 0 || strcmp(file, "..") == 0)
continue; continue;
const char *dest = ((std::string)USERDIR + file).c_str(); const char *dest = ((std::string)USERDIR + "/" + file).c_str();
const char *target = ((std::string)THEMEDIR_VAR + file).c_str(); const char *target = ((std::string)THEMESDIR_VAR + "/" + file).c_str();
printf("[neutrino theme] moving %s to %s\n", dest, target); printf("[neutrino theme] moving %s to %s\n", dest, target);
rename(dest, target); rename(dest, target);
} }