diff --git a/README.md b/README.md index deacb06..a74fd32 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,24 @@ [](https://gitter.im/buggins/dlangide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://travis-ci.org/buggins/dlangide) [](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) +
+example:
+{
+ "name" : "newworkspace",
+ "description" : null,
+ "projects" : {
+ "newproject" : "newproject/dub.json"
+ },
+ "includePath" : [
+ "/usr/include/dlang/dmd/"
+ ]
+}
+
+PS.
+ Sorry about bad code. Please correct me.
+
Dlang IDE
=========
diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d
index cf6a273..77b702d 100644
--- a/src/dlangide/workspace/project.d
+++ b/src/dlangide/workspace/project.d
@@ -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;
diff --git a/src/dlangide/workspace/workspace.d b/src/dlangide/workspace/workspace.d
index 66d4861..c01b0fa 100644
--- a/src/dlangide/workspace/workspace.d
+++ b/src/dlangide/workspace/workspace.d
@@ -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; }