[Question] How to get Treeview Selected Path?


I’m trying to get the Current Selected Project in the ‘tree-view’ Portion.


Is how i’m currently doing it.

I’m doing it inside of

atom.project.onDidChangePaths((projectPaths) => {
		 editor = atom.workspace.getActiveTextEditor();
		let data = atom.packages.getActivePackage('tree-view').mainModule.provideTreeView().selectedPaths()[0].split('\\').reverse()[0];
		projectName = data[0];
		//paths = atom.project.getPaths();
		//if(paths.length > 0) projectName = path.basename(paths[0]);
		//else projectName = null;

But for whatever reason, It doesnt seem to work. Anyone have a Idea?


It seems it has issues with the mainModule @.@


@Bioblaze You should be using the tree-view API rather than trying to use the mainModule, which is unsupported.