BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
qstringutils.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/utils/qstringutils.cpp
6 //! @brief Implements functions from Utils namespace
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 #include <QDir>
18 
19 namespace GUI_StringUtils {
20 
21 QString withTildeHomePath(const QString& path)
22 {
24  return path;
25 
26  static const QString homePath = QDir::homePath();
27 
28  QFileInfo fi(QDir::cleanPath(path));
29  QString outPath = fi.absoluteFilePath();
30  if (outPath.startsWith(homePath))
31  outPath = QLatin1Char('~') + outPath.mid(homePath.size());
32  else
33  outPath = path;
34  return outPath;
35 }
36 
37 } // namespace GUI_StringUtils
static bool isWindowsHost()
Definition: hostosinfo.h:67
Defines Utils namespace.
QString withTildeHomePath(const QString &path)
Defines functions from Utils namespace.