|
@@ -25,6 +25,8 @@ enum FileKind {
|
|
@:allow(hide.tools.FileManager)
|
|
@:allow(hide.tools.FileManager)
|
|
class FileEntry {
|
|
class FileEntry {
|
|
public var name: String;
|
|
public var name: String;
|
|
|
|
+ public var path: String;
|
|
|
|
+ public var relPath: String;
|
|
public var children: Array<FileEntry>;
|
|
public var children: Array<FileEntry>;
|
|
public var kind: FileKind;
|
|
public var kind: FileKind;
|
|
public var parent: FileEntry;
|
|
public var parent: FileEntry;
|
|
@@ -37,6 +39,8 @@ class FileEntry {
|
|
this.name = name;
|
|
this.name = name;
|
|
this.parent = parent;
|
|
this.parent = parent;
|
|
this.kind = kind;
|
|
this.kind = kind;
|
|
|
|
+ this.relPath = computeRelPath();
|
|
|
|
+ this.path = computePath();
|
|
|
|
|
|
watch();
|
|
watch();
|
|
FileManager.inst.fileIndex.set(this.getRelPath(), this);
|
|
FileManager.inst.fileIndex.set(this.getRelPath(), this);
|
|
@@ -107,15 +111,23 @@ class FileEntry {
|
|
registeredWatcher = hide.Ide.inst.fileWatcher.register(rel, FileManager.inst.fileChangeInternal.bind(this), true);
|
|
registeredWatcher = hide.Ide.inst.fileWatcher.register(rel, FileManager.inst.fileChangeInternal.bind(this), true);
|
|
}
|
|
}
|
|
|
|
|
|
- public function getPath() {
|
|
|
|
|
|
+ public inline function getRelPath() {
|
|
|
|
+ return this.relPath;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public inline function getPath() {
|
|
|
|
+ return this.path;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function computePath() {
|
|
if (this.parent == null) return hide.Ide.inst.resourceDir;
|
|
if (this.parent == null) return hide.Ide.inst.resourceDir;
|
|
- return this.parent.getPath() + "/" + this.name;
|
|
|
|
|
|
+ return this.parent.computePath() + "/" + this.name;
|
|
}
|
|
}
|
|
|
|
|
|
- public function getRelPath() {
|
|
|
|
|
|
+ function computeRelPath() {
|
|
if (this.parent == null) return "";
|
|
if (this.parent == null) return "";
|
|
if (this.parent.parent == null) return this.name;
|
|
if (this.parent.parent == null) return this.name;
|
|
- return this.parent.getRelPath() + "/" + this.name;
|
|
|
|
|
|
+ return this.parent.computeRelPath() + "/" + this.name;
|
|
}
|
|
}
|
|
|
|
|
|
// sort directories before files, and then dirs and files alphabetically
|
|
// sort directories before files, and then dirs and files alphabetically
|