summaryrefslogtreecommitdiffstats
path: root/src/qtchooser/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix checking return value of endsWithDmitry Shachnev2017-10-291-1/+1
| | | | | | | | | endsWith(buf, target) returns true when buf ends with target, not zero. So the current condition is reversed and fails when link is not pointing to qtchooser. Change-Id: Ia854ed0030fc2723e23011aea2c097f90603a04b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement fallback mechanism for some toolsDmitry Shachnev2015-02-101-8/+52
| | | | | | | | | | | | If a tool was requested without specifying the SDK name, and the default SDK does not have that tool, fall back to any installed SDK that contains that tool. Currently this is enabled only for qdbus, qmlscene, and for tools that are new in Qt 5. Change-Id: I19a82a06c75fe9cd624aa51b086d72e75310ba35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix possible buffer overrun in use of readlink(2)Thiago Macieira2014-12-181-2/+2
| | | | | | | | | | | | | | | | The man page says: readlink() does not append a null byte to buf. It will truncate the contents (to a length of bufsiz characters), in case the buffer is too small to hold all of the contents. [...] RETURN VALUE On success, these calls return the number of bytes placed in buf. So we need to pass size-1 so we'll have room for the NUL byte at the end. Change-Id: I9ccfb451f8dbe39bc1786864fbd4d0f018598e00 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* Add the install mode for qtchooserThiago Macieira2014-06-131-37/+184
| | | | | | Change-Id: I8bbd7fc683e341ca6af3b1396a655684233f5562 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Fix test failure: -list-versions must not include .confqtchooser-39-g4717841Thiago Macieira2013-12-161-6/+10
| | | | | | | | The output should match what gets put on the environment variable, in the -qt argument, etc. Change-Id: Ibab71182d7962cdd1ffa8e175810bfab987a3974 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Always ensure that the hardcoded paths are foundSune Vuorela2013-12-091-1/+1
| | | | | | | | | | | | Practice has shown that quite many sets XDG dirs for various purposes and that spoils qtchooser finding the distro provided Qt without adding like /usr to the XDG dirs variable which kind of kills performance. Provide a dedicated variable to disable a global installation. Change-Id: I58953e3b2b3cf43cb67d4c367312e83cfa9ad2b3 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Print a sorted list of Qt versionsThiago Macieira2013-05-231-8/+17
| | | | | | | Right now, we're getting a directory order, which is arbitrary. Change-Id: Ia40c62ba9704fcc22504b1282f430e1fb18255d9 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Use a regular function pointer for visitingThiago Macieira2013-05-231-4/+5
| | | | | | | No need for a PMF. Change-Id: I926b51be3e1a1a1ac4fb7dafc670b48a76fe88d2 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* create a system default pathqtchooser-31-g980c64cSune Vuorela2013-05-181-0/+7
| | | | | | | | | | | 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>
* Give home configurations precedence over system onesAndrea Scarpino2013-05-141-3/+4
| | | | | Change-Id: Ib0c4cf47c0ff5f716949cc5653ba27dad3558489 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use getline from POSIX.1-2008 when availablePino Toscano2013-04-261-1/+26
| | | | | | | | | | | Ask the standard library to use POSIX.1-2008, and if available use its getline function to read lines from the SDK configuration file. If not, fallback on the current way (fgets with PATH_MAX-sized buffer), which is now used only if PATH_MAX is defined. If neither POSIX.1-2008 nor PATH_MAX are available, error out. Change-Id: I8d2d256530d68884850535a6cd5908d1205035bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Can find and launch an app bundle on MacShawn Rutledge2013-03-281-0/+9
| | | | | | | | | | | Required for https://codereview.qt-project.org/#change,51502 If qml is an app bundle, we'd still like to be able to launch it just as easily on the command line. Change-Id: I37973b296b1da9d27e7f3bfff1c54487bbb387ea Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* argument -l is the same as -list-versions; double-dash is OK tooShawn Rutledge2013-03-221-2/+5
| | | | | | | | | Linux users tend to be accustomed to GNU-style options. Now qtchooser is agnostic about that. Change-Id: Idb9731cf6892c183370d863e4261936dc21e9ac8 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Warn about recursive callsFrederik Gladhorn2013-03-051-14/+36
| | | | | | | | | | Calling qdbus took a long time and 100% cpu since I had a broken setup. Instead of doing that, warn that the user callls a symlink to qtchooser itself. Change-Id: I968a6d637f51bf8138e196207b7f3bbae17883f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Expand leading tilde in tool path (for e.g. ~/dev/qt5)Shawn Rutledge2013-02-011-18/+20
| | | | | Change-Id: I712d22a40e75a9f36ccb5709844547249c24bf7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify the getenv use and handle the empty $HOME caseThiago Macieira2013-02-011-11/+28
| | | | | | | | | | | | | | getenv(3) can return NULL if the variable isn't set. Some Standard Library implementations (like Clang's libc++) do not like a NULL as the argument to std::string's constructor, which is why the code is so convoluted as it is. Instead, simplify the code by having a getenv wrapper that has a default value. And handle the case of the empty $HOME: currently, if it isn't set, the application would crash. Instead, use getpwuid as a fallback. Change-Id: I0185dbc7b026a5978b678207b31de90cba531623 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Accept -run-tool if and only if the tool wasn't already selectedThiago Macieira2013-01-181-13/+11
| | | | | | | | | | That means we invert the order of overriding. Previously, -run-tool overrode the environment, which overrode argv[0]. Now, argv[0] overrides the environment, which overrides -run-tool. Change-Id: I60bd5e1397cb5a6cb8b0df9c1c3ebba6210ed920 Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Accept the -print-env and -list-versions commands only on "qtchooser"Thiago Macieira2013-01-021-11/+43
| | | | | | | | | Do not accept those options when called with another tool, especially when using argv[0]. This allows the target tools to have options with identical names. Change-Id: I7c2881100ccc10c73ddfc5d15dcc7f89555392cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a help mode to the tool, printing the usageThiago Macieira2013-01-021-3/+39
| | | | | | | Only if another tool isn't specified somehow. Change-Id: I5c0068809cb49054012c14afa388b355efa6dd2d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove the test-mode variablesThiago Macieira2012-12-291-29/+22
| | | | | | | | | | | | | One of the bugs I found during development was in the code handling the XDG data paths, which wasn't exercised during testing. So exercise it instead. Now the test-mode build will be exact the same as the normal code, except that it won't actually run the target executable. Change-Id: I829ed252836b2b581cd61c7dfab9d3061377e8f0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Long live the Qt tool chooserThiago Macieira2012-12-191-0/+371
This tool wraps the execution of the other tools. It's supposed to live on systems' /usr/bin dir or equivalent. WIP: need to compile on Mac, I need to know which libs are necessary for the FSFindFolder function (can't find the documentation on Apple's website). Change-Id: I1c429a159a4e02b78a835888d470514d8e4a23a7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>