aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fluxbox.cc26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 61025a2..d92f64e 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -149,22 +149,6 @@ static Bool queueScanner(Display *, XEvent *e, char *args) {
149 return False; 149 return False;
150} 150}
151 151
152//------------- expandFilename ----------------------
153// if ~ then expand it to home of user
154// returns expanded filename
155// (note: the function creates new memory for the string)
156//---------------------------------------------------
157char *Fluxbox::expandFilename(char *filename) {
158 char retval[strlen(filename)+strlen(getenv("HOME"))+2]; //2 extra byte just to be safe
159 retval[0]=0; //mark end
160 if (filename[0]=='~') {
161 strcat(retval, getenv("HOME"));
162 strcat(retval, &filename[1]);
163 } else
164 return Misc::strdup(filename); //return unmodified value
165
166 return Misc::strdup(retval); //return modified value
167}
168 152
169//static singleton var 153//static singleton var
170Fluxbox *Fluxbox::singleton=0; 154Fluxbox *Fluxbox::singleton=0;
@@ -1750,7 +1734,7 @@ void Fluxbox::load_rc(void) {
1750 if (XrmGetResource(database, "session.menuFile", "Session.MenuFile", 1734 if (XrmGetResource(database, "session.menuFile", "Session.MenuFile",
1751 &value_type, &value)) { 1735 &value_type, &value)) {
1752 1736
1753 resource.menu_file = expandFilename(value.addr); // expand ~ to $HOME 1737 resource.menu_file = Misc::expandFilename(value.addr); // expand ~ to $HOME
1754 } else 1738 } else
1755 resource.menu_file = Misc::strdup(DEFAULTMENU); 1739 resource.menu_file = Misc::strdup(DEFAULTMENU);
1756 1740
@@ -1762,7 +1746,7 @@ void Fluxbox::load_rc(void) {
1762 //get titlebar filename 1746 //get titlebar filename
1763 if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile", 1747 if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile",
1764 &value_type, &value)) { 1748 &value_type, &value)) {
1765 resource.titlebar_file = expandFilename(value.addr); //expand ~ to home 1749 resource.titlebar_file = Misc::expandFilename(value.addr); //expand ~ to home
1766 } else 1750 } else
1767 resource.titlebar_file = Misc::strdup(DEFAULTTITLEBAR); 1751 resource.titlebar_file = Misc::strdup(DEFAULTTITLEBAR);
1768 1752
@@ -1775,7 +1759,7 @@ void Fluxbox::load_rc(void) {
1775 //get keys filename 1759 //get keys filename
1776 if (XrmGetResource(database, "session.keyFile", "Session.keyFile", 1760 if (XrmGetResource(database, "session.keyFile", "Session.keyFile",
1777 &value_type, &value)) { 1761 &value_type, &value)) {
1778 resource.keys_file = expandFilename(value.addr); //expand ~ to home 1762 resource.keys_file = Misc::expandFilename(value.addr); //expand ~ to home
1779 } else 1763 } else
1780 resource.keys_file = Misc::strdup(DEFAULTKEYSFILE); 1764 resource.keys_file = Misc::strdup(DEFAULTKEYSFILE);
1781 1765
@@ -1816,7 +1800,7 @@ void Fluxbox::load_rc(void) {
1816 1800
1817 if (XrmGetResource(database, "session.styleFile", "Session.StyleFile", 1801 if (XrmGetResource(database, "session.styleFile", "Session.StyleFile",
1818 &value_type, &value)) 1802 &value_type, &value))
1819 resource.style_file = expandFilename(value.addr); 1803 resource.style_file = Misc::expandFilename(value.addr);
1820 else 1804 else
1821 resource.style_file = Misc::strdup(DEFAULTSTYLE); 1805 resource.style_file = Misc::strdup(DEFAULTSTYLE);
1822 1806
@@ -1826,7 +1810,7 @@ void Fluxbox::load_rc(void) {
1826 } 1810 }
1827 1811
1828 if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value)) 1812 if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value))
1829 resource.root_cmd = expandFilename(value.addr); 1813 resource.root_cmd = Misc::expandFilename(value.addr);
1830 else 1814 else
1831 resource.root_cmd = 0; 1815 resource.root_cmd = 0;
1832 1816