mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
New "PathUtils" Utils function, to help plugins detect where the "share" directory is located. Should be improved but it is a start.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1569 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c225153723
commit
2b70ed53f7
@ -81,6 +81,10 @@ macx {
|
|||||||
!isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
|
!isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DEFINES += GCS_DATA_PATH=\\\"$$GCS_DATA_PATH\\\"
|
||||||
|
|
||||||
|
|
||||||
INCLUDEPATH += \
|
INCLUDEPATH += \
|
||||||
$$GCS_SOURCE_TREE/src/libs
|
$$GCS_SOURCE_TREE/src/libs
|
||||||
|
|
||||||
|
57
ground/src/libs/utils/pathutils.cpp
Normal file
57
ground/src/libs/utils/pathutils.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file pathutils.cpp
|
||||||
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
|
* @brief Utilities to find the location of openpilot GCS files:
|
||||||
|
* - Plugins Share directory path
|
||||||
|
*
|
||||||
|
* @see The GNU Public License (GPL) Version 3
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pathutils.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
PathUtils::PathUtils()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the base path of the share directory
|
||||||
|
*/
|
||||||
|
QString PathUtils::GetDataPath()
|
||||||
|
{
|
||||||
|
// Figure out root: Up one from 'bin'
|
||||||
|
//QDir rootDir = QApplication::applicationDirPath();
|
||||||
|
//rootDir.cdUp();
|
||||||
|
//const QString rootDirPath = rootDir.canonicalPath();
|
||||||
|
//QString pluginPath = rootDirPath;
|
||||||
|
//pluginPath += QLatin1Char('/');
|
||||||
|
QString pluginPath = QLatin1String(GCS_DATA_PATH);
|
||||||
|
pluginPath += QLatin1Char('/');
|
||||||
|
return pluginPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
49
ground/src/libs/utils/pathutils.h
Normal file
49
ground/src/libs/utils/pathutils.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file pathutils.h
|
||||||
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
|
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||||
|
* @brief
|
||||||
|
* @see The GNU Public License (GPL) Version 3
|
||||||
|
* @defgroup
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PATHUTILS_H
|
||||||
|
#define PATHUTILS_H
|
||||||
|
|
||||||
|
#include "utils_global.h"
|
||||||
|
#include "../extensionsystem/pluginmanager.h"
|
||||||
|
#include <QDir>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT PathUtils
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PathUtils();
|
||||||
|
QString GetDataPath();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* PATHUTILS_H */
|
@ -37,7 +37,8 @@ SOURCES += reloadpromptutils.cpp \
|
|||||||
fancymainwindow.cpp \
|
fancymainwindow.cpp \
|
||||||
detailsbutton.cpp \
|
detailsbutton.cpp \
|
||||||
detailswidget.cpp \
|
detailswidget.cpp \
|
||||||
coordinateconversions.cpp
|
coordinateconversions.cpp \
|
||||||
|
pathutils.cpp
|
||||||
win32 {
|
win32 {
|
||||||
SOURCES += abstractprocess_win.cpp \
|
SOURCES += abstractprocess_win.cpp \
|
||||||
consoleprocess_win.cpp \
|
consoleprocess_win.cpp \
|
||||||
@ -82,7 +83,8 @@ HEADERS += utils_global.h \
|
|||||||
fancymainwindow.h \
|
fancymainwindow.h \
|
||||||
detailsbutton.h \
|
detailsbutton.h \
|
||||||
detailswidget.h \
|
detailswidget.h \
|
||||||
coordinateconversions.h
|
coordinateconversions.h \
|
||||||
|
pathutils.h
|
||||||
FORMS += filewizardpage.ui \
|
FORMS += filewizardpage.ui \
|
||||||
projectintropage.ui \
|
projectintropage.ui \
|
||||||
newclasswidget.ui \
|
newclasswidget.ui \
|
||||||
|
Loading…
Reference in New Issue
Block a user