Skip to content

Commit

Permalink
Fix home path environment variable in Eclipse project on Windows // R…
Browse files Browse the repository at this point in the history
…esolve #270
  • Loading branch information
valeros committed Aug 20, 2015
1 parent 3393d81 commit 1b41ffb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion platformio/ide/projectgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@ def _gather_tplvars(self):
if build_data and "defines" in build_data else []),
"srcfiles": self.get_srcfiles(),
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir
"project_dir": self.project_dir,
"systype": util.get_systype()
})
12 changes: 12 additions & 0 deletions platformio/ide/tpls/eclipse/.cproject.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
% if "windows" in systype:
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% end
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
Expand All @@ -42,7 +46,11 @@
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
% if "windows" in systype:
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% end
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
Expand All @@ -59,7 +67,11 @@
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
% if "windows" in systype:
<listOptionValue builtIn="false" value="${USERPROFILE}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% end
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
Expand Down

0 comments on commit 1b41ffb

Please sign in to comment.