aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/App.cc9
-rw-r--r--src/FbTk/FileUtil.cc11
-rw-r--r--src/FbTk/StringUtil.cc2
3 files changed, 16 insertions, 6 deletions
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc
index 8157839..f494a0e 100644
--- a/src/FbTk/App.cc
+++ b/src/FbTk/App.cc
@@ -60,8 +60,13 @@ App::App(const char *displayname):m_done(false), m_display(0) {
60 if (displayname != 0 && displayname[0] == '\0') 60 if (displayname != 0 && displayname[0] == '\0')
61 displayname = 0; 61 displayname = 0;
62 m_display = XOpenDisplay(displayname); 62 m_display = XOpenDisplay(displayname);
63 if (!m_display) 63 if (!m_display) {
64 throw std::string("Couldn't connect to XServer"); 64 if (displayname) {
65 throw std::string("Couldn't connect to XServer") + displayname;
66 } else {
67 throw std::string("Couldn't connect to XServer passing null display");
68 }
69 }
65 70
66 FbStringUtil::init(); 71 FbStringUtil::init();
67} 72}
diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc
index 5de560b..c92b336 100644
--- a/src/FbTk/FileUtil.cc
+++ b/src/FbTk/FileUtil.cc
@@ -63,9 +63,14 @@ bool FileUtil::isExecutable(const char* filename) {
63 if (!filename || stat(filename, &buf)) 63 if (!filename || stat(filename, &buf))
64 return false; 64 return false;
65 65
66 return buf.st_mode & S_IXUSR || 66 return buf.st_mode & S_IXUSR
67 buf.st_mode & S_IXGRP || 67#ifdef S_IXGRP
68 buf.st_mode & S_IXOTH; 68 || buf.st_mode & S_IXGRP
69#endif
70#ifdef S_IXOTH
71 || buf.st_mode & S_IXOTH
72#endif
73 ;
69} 74}
70 75
71bool FileUtil::copyFile(const char* from, const char* to) { 76bool FileUtil::copyFile(const char* from, const char* to) {
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc
index 0a7ebd3..f76a1f9 100644
--- a/src/FbTk/StringUtil.cc
+++ b/src/FbTk/StringUtil.cc
@@ -176,7 +176,7 @@ string expandFilename(const string &filename) {
176 size_t pos = filename.find_first_not_of(" \t"); 176 size_t pos = filename.find_first_not_of(" \t");
177 if (pos != string::npos && filename[pos] == '~') { 177 if (pos != string::npos && filename[pos] == '~') {
178 retval = getenv("HOME"); 178 retval = getenv("HOME");
179 if (pos != filename.size()) { 179 if (pos + 1 < filename.size()) {
180 // copy from the character after '~' 180 // copy from the character after '~'
181 retval += static_cast<const char *>(filename.c_str() + pos + 1); 181 retval += static_cast<const char *>(filename.c_str() + pos + 1);
182 } 182 }