Merge pull request #189 from AckeardOct/master

Settings for DCD include path from project settings file
This commit is contained in:
Vadim Lopatin 2016-11-20 19:53:02 +04:00 committed by GitHub
commit af8babdf1b
3 changed files with 35 additions and 0 deletions

View File

@ -1,5 +1,24 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/buggins/dlangide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/buggins/dlangide.svg?branch=master)](https://travis-ci.org/buggins/dlangide) [![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ "Donate once-off to this project using Paypal")
WTF?! (What The Fork)
======================
Now you can set dmd includes paths (for correct work with DCD) in workspace settings file (newworkspace.dlangidews)
<pre>
example:
{
"name" : "newworkspace",
"description" : null,
"projects" : {
"newproject" : "newproject/dub.json"<br>
},
"includePath" : [
"/usr/include/dlang/dmd/"
]
}
</pre>
PS.
Sorry about bad code. Please correct me.
Dlang IDE
=========

View File

@ -12,6 +12,8 @@ import std.path;
import std.process;
import std.utf;
string[] includePath;
/// return true if filename matches rules for workspace file names
bool isProjectFile(in string filename) pure nothrow {
return filename.baseName.equal("dub.json") || filename.baseName.equal("DUB.JSON") || filename.baseName.equal("package.json") ||
@ -284,6 +286,11 @@ class WorkspaceItem {
/// detect DMD source paths
string[] dmdSourcePaths() {
string[] res;
if(!includePath.empty){
res ~= includePath;
}
version(Windows) {
import dlangui.core.files;
string dmdPath = findExecutablePath("dmd");
@ -371,6 +378,10 @@ class Project : WorkspaceItem {
this(Workspace ws, string fname = null, string dependencyVersion = null) {
super(fname);
_workspace = ws;
foreach(obj; _workspace.includePath.array)
includePath ~= obj.str;
_items = new ProjectFolder(fname);
_dependencyVersion = dependencyVersion;
_isDependency = _dependencyVersion.length > 0;

View File

@ -75,6 +75,11 @@ class Workspace : WorkspaceItem {
return null;
}
@property Setting includePath(){
Setting res = _workspaceFile.objectByPath("includePath", true);
return res;
}
@property Project[] projects() { return _projects; }
@property BuildConfiguration buildConfiguration() { return _buildConfiguration; }