diff options
author | Sune Vuorela <sune@vuorela.dk> | 2012-12-29 23:56:27 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2013-05-18 23:57:33 +0200 |
commit | 980c64c7fac5cfe39593e5a12e233be69d0742e3 (patch) | |
tree | 4c028da7b5e4a871382dff84ed3d16014e42be92 /src | |
parent | 50373acdaf8ecd56d9fc0b31ee2f8f06f448c1a3 (diff) | |
download | qtchooser-980c64c7fac5cfe39593e5a12e233be69d0742e3.tar.gz qtchooser-980c64c7fac5cfe39593e5a12e233be69d0742e3.tar.bz2 qtchooser-980c64c7fac5cfe39593e5a12e233be69d0742e3.zip |
create a system default path
Make it possible to build qtchooser with a system default search path
build using make QTCHOOSER_GLOBAL_DIR=/usr/share/ will make qtchooser
fall back to search in /usr/share/qtchooser/ as a last option if
XDG_CONFIG_DIRS is not set
Change-Id: Ie0d438ddc1e259d4c5fb70aa332bd6bfef2448e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qtchooser/Makefile | 8 | ||||
-rw-r--r-- | src/qtchooser/main.cpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/qtchooser/Makefile b/src/qtchooser/Makefile index fcff0ce..6ad619a 100644 --- a/src/qtchooser/Makefile +++ b/src/qtchooser/Makefile @@ -17,6 +17,10 @@ TARGET = qtchooser OBJECTS_TEST = main-test.o TARGET_TEST = test/qtchooser +ifneq ($(QTCHOOSER_GLOBAL_DIR),) + QTCHOOSER_GLOBAL_DIR_VAR:=-DQTCHOOSER_GLOBAL_DIR=\"$(QTCHOOSER_GLOBAL_DIR)\" +endif + first: all check: $(TARGET_TEST) @@ -49,10 +53,10 @@ uninstall: ####### Compile main.o: main.cpp - $(CXX) -c -Wall -Wextra $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + $(CXX) -c -Wall -Wextra $(QTCHOOSER_GLOBAL_DIR_VAR) $(CXXFLAGS) $(INCPATH) -o main.o main.cpp main-test.o: main.cpp - $(CXX) -c -Wall -Wextra -DQTCHOOSER_TEST_MODE -g $(CXXFLAGS) $(INCPATH) -o main-test.o main.cpp + $(CXX) -c -Wall -Wextra -DQTCHOOSER_TEST_MODE $(QTCHOOSER_GLOBAL_DIR_VAR) -g $(CXXFLAGS) $(INCPATH) -o main-test.o main.cpp ####### Install diff --git a/src/qtchooser/main.cpp b/src/qtchooser/main.cpp index 514503d..61d8731 100644 --- a/src/qtchooser/main.cpp +++ b/src/qtchooser/main.cpp @@ -279,6 +279,13 @@ vector<string> ToolWrapper::searchPaths() const vector<string> xdgPaths = stringSplit(qgetenv("XDG_CONFIG_DIRS", "/etc/xdg").c_str()); paths.insert(paths.end(), xdgPaths.begin(), xdgPaths.end()); +#if defined(QTCHOOSER_GLOBAL_DIR) + if (qgetenv("XDG_CONFIG_DIRS").empty()) { + vector<string> globalPaths = stringSplit(QTCHOOSER_GLOBAL_DIR); + paths.insert(paths.end(), globalPaths.begin(), globalPaths.end()); + } +#endif + for (vector<string>::iterator it = paths.begin(); it != paths.end(); ++it) *it += "/qtchooser/"; |