Description
The WatchForChanges
method in the Sandbox.Compiler
class is responsible for monitoring the filesystem for any changes to C# files. When a change is detected, it triggers a recompilation of the affected files. This is particularly useful during development to ensure that the latest code changes are always compiled and ready for use without manual intervention.
Usage
To use the WatchForChanges
method, simply call it on an instance of the Sandbox.Compiler
class. This will start the process of monitoring the specified directories for any changes to C# files. Ensure that the necessary file system permissions are in place to allow the monitoring of file changes.
Example
// Example of using WatchForChanges
// Create an instance of the Compiler class
Sandbox.Compiler compiler = new Sandbox.Compiler();
// Start watching for changes in the file system
compiler.WatchForChanges();
// The compiler will now automatically recompile when changes are detected in the C# files.