Procházet zdrojové kódy

Merge branch 'master' of https://github.com/HeapsIO/hide

Tom SPIRA před 6 roky
rodič
revize
a36e3e180c
3 změnil soubory, kde provedl 21 přidání a 11 odebrání
  1. 5 0
      bin/defaultProps.json
  2. 3 2
      hide/Plugin.hx
  3. 13 9
      hide/view/FileTree.hx

+ 5 - 0
bin/defaultProps.json

@@ -41,6 +41,11 @@
 
 	"key.view.fullScreen" : "F11",
 
+	// File tree
+	"filetree.excludes": [
+		"(^|\/)\\.[^.]*$"
+	],
+
 	// cdb keys
 
 	"key.cdb.showReferences" : "Shift+F12",

+ 3 - 2
hide/Plugin.hx

@@ -11,6 +11,7 @@ class Plugin {
 	static var haxelibRoot = sys.io.File.getContent(Sys.getEnv("USERPROFILE")+"/.haxelib");
 	static var EXCLUDES = [
 		"hide",
+		"hrt",
 
 		"h2d",
 		"h3d",
@@ -42,11 +43,11 @@ class Plugin {
 
 	static function getLibraryPath( libName ) {
 		var libPath = haxelibRoot+"/"+libName;
-		var dev = try sys.io.File.getContent(libPath+"/.dev") catch( e : Dynamic ) null;
+		var dev = try StringTools.trim(sys.io.File.getContent(libPath+"/.dev")) catch( e : Dynamic ) null;
 		if( dev != null )
 			libPath = dev;
 		else {
-			var cur = try sys.io.File.getContent(libPath+"/.current") catch( e : Dynamic ) null;
+			var cur = try StringTools.trim(sys.io.File.getContent(libPath+"/.current")) catch( e : Dynamic ) null;
 			if( cur == null )
 				throw "Library not installed '"+libName+"'";
 			libPath += "/"+cur.split(".").join(",");

+ 13 - 9
hide/view/FileTree.hx

@@ -15,9 +15,15 @@ class FileTree extends FileView {
 
 	var tree : hide.comp.IconTree<String>;
 	var lastOpen : hide.ui.View<Dynamic>;
+	var ignorePatterns : Array<EReg> = [];
 
 	public function new(state) {
 		super(state);
+
+		var exclPatterns : Array<String> = ide.currentConfig.get("filetree.excludes", []);
+		for(pat in exclPatterns)
+			ignorePatterns.push(new EReg(pat, "i"));
+
 		if( state.path == null ) {
 			ide.chooseDirectory(function(dir) {
 				if( dir == null ) {
@@ -65,13 +71,14 @@ class FileTree extends FileView {
 		tree.async = true;
 		tree.allowRename = true;
 		tree.saveDisplayKey = "FileTree:" + getPath().split("\\").join("/").substr(0,-1);
+		tree.element.addClass("small");
 		tree.get = function(path) {
 			if( path == null ) path = "";
 			var basePath = getFilePath(path);
 			var content = new Array<hide.comp.IconTree.IconTreeItem<String>>();
 			for( c in sys.FileSystem.readDirectory(basePath) ) {
-				if( isIgnored(basePath, c) ) continue;
 				var fullPath = basePath + "/" + c;
+				if( isIgnored(fullPath) ) continue;
 				var isDir = sys.FileSystem.isDirectory(fullPath);
 				var ext = getExtension(fullPath);
 				var id = ( path == "" ? c : path+"/"+c );
@@ -305,14 +312,11 @@ class FileTree extends FileView {
 		onOpenFile(fpath);
 	}
 
-	function isIgnored( path : String, file : String ) {
-		if( file.charCodeAt(0) == ".".code )
-			return true;
-		var ext = file.split(".").pop().toLowerCase();
-		if( StringTools.startsWith(file, "Anim_") && ext == "fbx" )
-			return true;
-		if( ext == "dat" && sys.FileSystem.isDirectory(path) )
-			return true;
+	function isIgnored( fullpath : String ) {
+		for(pat in ignorePatterns) {
+			if(pat.match(fullpath))
+				return true;
+		}
 		return false;
 	}