mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 05:53:10 +02:00
Added a static function GMenu2X::getHome() that returns GMenu2X's user-specific directory (usually ~/.gmenu2x).
This commit is contained in:
parent
758b7b183c
commit
8693dff072
@ -87,6 +87,7 @@ const char *CARD_ROOT = "/card/"; //Note: Add a trailing /!
|
|||||||
const int CARD_ROOT_LEN = 5;
|
const int CARD_ROOT_LEN = 5;
|
||||||
|
|
||||||
static GMenu2X *app;
|
static GMenu2X *app;
|
||||||
|
static string gmenu2x_home;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fastdelegate;
|
using namespace fastdelegate;
|
||||||
@ -121,6 +122,11 @@ static void quit_all(int err) {
|
|||||||
exit(err);
|
exit(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string GMenu2X::getHome(void)
|
||||||
|
{
|
||||||
|
return gmenu2x_home;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int /*argc*/, char * /*argv*/[]) {
|
int main(int /*argc*/, char * /*argv*/[]) {
|
||||||
INFO("----\nGMenu2X starting: If you read this message in the logs, check http://gmenu2x.sourceforge.net/page/Troubleshooting for a solution\n----\n");
|
INFO("----\nGMenu2X starting: If you read this message in the logs, check http://gmenu2x.sourceforge.net/page/Troubleshooting for a solution\n----\n");
|
||||||
|
|
||||||
@ -128,6 +134,20 @@ int main(int /*argc*/, char * /*argv*/[]) {
|
|||||||
signal(SIGSEGV,&quit_all);
|
signal(SIGSEGV,&quit_all);
|
||||||
signal(SIGTERM,&quit_all);
|
signal(SIGTERM,&quit_all);
|
||||||
|
|
||||||
|
char *home = getenv("HOME");
|
||||||
|
if (home == NULL) {
|
||||||
|
ERROR("Unable to find gmenu2x home directory. The $HOME variable is not defined.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gmenu2x_home = (string)home + (string)"/.gmenu2x";
|
||||||
|
if (!fileExists(gmenu2x_home) && mkdir(gmenu2x_home.c_str(), 0770) < 0) {
|
||||||
|
ERROR("Unable to create gmenu2x home directory.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG("Home path: %s.\n", gmenu2x_home.c_str());
|
||||||
|
|
||||||
app = new GMenu2X();
|
app = new GMenu2X();
|
||||||
DEBUG("Starting main()\n");
|
DEBUG("Starting main()\n");
|
||||||
app->main();
|
app->main();
|
||||||
|
@ -155,6 +155,10 @@ public:
|
|||||||
~GMenu2X();
|
~GMenu2X();
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
|
/* Returns the home directory of gmenu2x, usually
|
||||||
|
* ~/.gmenu2x */
|
||||||
|
static const string getHome(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables needed for elements disposition
|
* Variables needed for elements disposition
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user