1 /**
2 Resource filesystem, as the editor sees it.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.editorfilesystem;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.node;
23 import godot.editorfilesystemdirectory;
24 /**
25 Resource filesystem, as the editor sees it.
26 
27 This object holds information of all resources in the filesystem, their types, etc.
28 */
29 @GodotBaseClass struct EditorFileSystem
30 {
31 	enum string _GODOT_internal_name = "EditorFileSystem";
32 public:
33 @nogc nothrow:
34 	union { godot_object _godot_object; Node _GODOT_base; }
35 	alias _GODOT_base this;
36 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
37 	package(godot) __gshared bool _classBindingInitialized = false;
38 	package(godot) static struct _classBinding
39 	{
40 		__gshared:
41 		@GodotName("get_filesystem") GodotMethod!(EditorFileSystemDirectory) getFilesystem;
42 		@GodotName("is_scanning") GodotMethod!(bool) isScanning;
43 		@GodotName("get_scanning_progress") GodotMethod!(double) getScanningProgress;
44 		@GodotName("scan") GodotMethod!(void) scan;
45 		@GodotName("scan_sources") GodotMethod!(void) scanSources;
46 		@GodotName("update_file") GodotMethod!(void, String) updateFile;
47 		@GodotName("get_filesystem_path") GodotMethod!(EditorFileSystemDirectory, String) getFilesystemPath;
48 		@GodotName("get_file_type") GodotMethod!(String, String) getFileType;
49 		@GodotName("update_script_classes") GodotMethod!(void) updateScriptClasses;
50 	}
51 	bool opEquals(in EditorFileSystem other) const { return _godot_object.ptr is other._godot_object.ptr; }
52 	EditorFileSystem opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
53 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
54 	mixin baseCasts;
55 	static EditorFileSystem _new()
56 	{
57 		static godot_class_constructor constructor;
58 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorFileSystem");
59 		if(constructor is null) return typeof(this).init;
60 		return cast(EditorFileSystem)(constructor());
61 	}
62 	@disable new(size_t s);
63 	/**
64 	Get the root directory object.
65 	*/
66 	EditorFileSystemDirectory getFilesystem()
67 	{
68 		checkClassBinding!(typeof(this))();
69 		return ptrcall!(EditorFileSystemDirectory)(_classBinding.getFilesystem, _godot_object);
70 	}
71 	/**
72 	Return true of the filesystem is being scanned.
73 	*/
74 	bool isScanning() const
75 	{
76 		checkClassBinding!(typeof(this))();
77 		return ptrcall!(bool)(_classBinding.isScanning, _godot_object);
78 	}
79 	/**
80 	Return the scan progress for 0 to 1 if the FS is being scanned.
81 	*/
82 	double getScanningProgress() const
83 	{
84 		checkClassBinding!(typeof(this))();
85 		return ptrcall!(double)(_classBinding.getScanningProgress, _godot_object);
86 	}
87 	/**
88 	Scan the filesystem for changes.
89 	*/
90 	void scan()
91 	{
92 		checkClassBinding!(typeof(this))();
93 		ptrcall!(void)(_classBinding.scan, _godot_object);
94 	}
95 	/**
96 	Check if the source of any imported resource changed.
97 	*/
98 	void scanSources()
99 	{
100 		checkClassBinding!(typeof(this))();
101 		ptrcall!(void)(_classBinding.scanSources, _godot_object);
102 	}
103 	/**
104 	Update a file information. Call this if an external program (not Godot) modified the file.
105 	*/
106 	void updateFile(StringArg0)(in StringArg0 path)
107 	{
108 		checkClassBinding!(typeof(this))();
109 		ptrcall!(void)(_classBinding.updateFile, _godot_object, path);
110 	}
111 	/**
112 	Returns a view into the filesystem at `path`.
113 	*/
114 	EditorFileSystemDirectory getFilesystemPath(StringArg0)(in StringArg0 path)
115 	{
116 		checkClassBinding!(typeof(this))();
117 		return ptrcall!(EditorFileSystemDirectory)(_classBinding.getFilesystemPath, _godot_object, path);
118 	}
119 	/**
120 	Get the type of the file, given the full path.
121 	*/
122 	String getFileType(StringArg0)(in StringArg0 path) const
123 	{
124 		checkClassBinding!(typeof(this))();
125 		return ptrcall!(String)(_classBinding.getFileType, _godot_object, path);
126 	}
127 	/**
128 	
129 	*/
130 	void updateScriptClasses()
131 	{
132 		checkClassBinding!(typeof(this))();
133 		ptrcall!(void)(_classBinding.updateScriptClasses, _godot_object);
134 	}
135 }