Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set haxe build working directory from treeview #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/haxe-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ module.exports = {
this.valid = true;
},

set_hxml_cwd:function(cwd) {
this.hxml_cwd = cwd || path.dirname(file);
log.debug('state hxml cwd to ' + this.hxml_cwd);
},

set_hxml_content:function(file_content, cwd) {
this.unset(true);
this.hxml_content = file_content;
Expand Down
22 changes: 22 additions & 0 deletions lib/haxe.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@ module.exports = {

}, //set_hxml_file_from_treeview

set_hxml_cwd_from_treeview: function(opt) {

var treeview = atom.packages.getLoadedPackage('tree-view');
if(!treeview) return;

treeview = require(treeview.mainModulePath);

var package_obj = treeview.serialize();
var file_path = package_obj.selectedPath;

state.set_hxml_cwd( file_path );

}, //set_hxml_cwd_from_treeview

build: function(e) {

//continue propogation if
Expand Down Expand Up @@ -269,6 +283,9 @@ module.exports = {
this._command('set-hxml-file',
this.set_hxml_file_from_treeview.bind(this) );

this._command('set-hxml-cwd',
this.set_hxml_cwd_from_treeview.bind(this) );

this._command('clear-project',
state.unset.bind(state) );

Expand All @@ -289,6 +306,11 @@ module.exports = {
{ type: 'separator' },
{ label: 'Set as active HXML file', command: 'haxe:set-hxml-file', shouldDisplay:this.display_context_tree.bind(this) },
{ type: 'separator' }
],
".tree-view .directory > div": [
{ type: 'separator' },
{ label: 'Set Haxe build working directory', command: 'haxe:set-hxml-cwd' },
{ type: 'separator' }
]
});

Expand Down