aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2010-03-25 13:19:27 +0100
committerTobias Hunger <tobias.hunger@nokia.com>2010-03-25 14:21:43 +0100
commit1ca8cb239759efd59b841b262e7fe618ff18d99a (patch)
treed74acbbae2d363bfad34f7cb5f7456f07de53f38 /src/plugins/projectexplorer
parent3a15c8c3c543adcc42eec8a30a7675ddd3b90526 (diff)
Introduce method to access the project directory
... use it. Reviewed-by: dt
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/project.cpp6
-rw-r--r--src/plugins/projectexplorer/project.h3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 9ca03a3993..fb6793b9d5 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -227,6 +227,12 @@ QVariantMap Project::toMap() const
return map;
}
+QString Project::projectDirectory() const
+{
+ QFileInfo info(file()->fileName());
+ return info.absoluteDir().path();
+}
+
bool Project::fromMap(const QVariantMap &map)
{
if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) {
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 87599ab702..10b6bb3953 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -128,6 +128,9 @@ public:
// creating new BuilConfigurations.
virtual QVariantMap toMap() const;
+ // The directory that holds the project file. This includes the absolute path.
+ QString projectDirectory() const;
+
signals:
void fileListChanged();
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 91536d39bd..40be6f84bc 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -912,8 +912,7 @@ void ProjectExplorerPlugin::newProject()
QString defaultLocation;
if (currentProject()) {
- const QFileInfo file(currentProject()->file()->fileName());
- QDir dir = file.dir();
+ QDir dir(currentProject()->projectDirectory());
dir.cdUp();
defaultLocation = dir.absolutePath();
}