#ifndef SRC_UTILS_PATH_HELPER_H_

#define SRC_UTILS_PATH_HELPER_H_

#include <QFile>
#include <QUrl>
#include <QDir>
#include <QCoreApplication>
#include <string>

inline QString absolutePathOfRelativeUrl(QUrl url)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(url.toLocalFile());
}

inline std::string absolutePathOfRelativePath(std::string relativePath)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(QString(relativePath.c_str()))
      .toStdString();
}

#endif  // SRC_UTILS_PATH_HELPER_H_

#ifndef SRC_UTILS_PATH_HELPER_H_

#define SRC_UTILS_PATH_HELPER_H_

#include <QFile>
#include <QUrl>
#include <QDir>
#include <QCoreApplication>
#include <string>
#include "./project_root.h"

inline QString relativeApplicationToProjectRootPath()
{
  return QDir(QCoreApplication::applicationDirPath())
      .relativeFilePath(QString(PROJECT_ROOT));
}

inline QString absolutePathOfRelativeUrl(QUrl url)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(url.toLocalFile());
}

inline QString absolutePathOfProjectRelativePath(QString path)
{
  return QDir(QDir(QCoreApplication::applicationDirPath())
                  .absoluteFilePath(relativeApplicationToProjectRootPath()))
      .absoluteFilePath(path);
}

inline QString absolutePathOfProjectRelativeUrl(QUrl url)
{
  return absolutePathOfProjectRelativePath(url.toLocalFile());
}

inline std::string absolutePathOfRelativePath(std::string relativePath)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(QString(relativePath.c_str()))
      .toStdString();
}

inline std::string absolutePathOfProjectRelativePath(std::string relativePath)
{
  return absolutePathOfProjectRelativePath(QString(relativePath.c_str()))
      .toStdString();
}

#endif  // SRC_UTILS_PATH_HELPER_H_

Add path helpers which handle paths relative to project root.
Add path helpers which handle paths relative to project root.
