File tree Expand file tree Collapse file tree
Source/Processors/RecordNode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,12 +75,31 @@ RecordNode::RecordNode()
7575
7676 eventMonitor = new EventMonitor ();
7777
78+ checkDiskSpace ();
79+
7880}
7981
8082RecordNode::~RecordNode ()
8183{
8284}
8385
86+ void RecordNode::checkDiskSpace ()
87+ {
88+ int diskSpaceWarningThreshold = 5 ; // GB
89+
90+ File dataDir (dataDirectory);
91+ int64 freeSpace = dataDir.getBytesFreeOnVolume ();
92+
93+ float avaialableBytes = freeSpace / pow (2 , 30 ); // 1 GB == 2^30 bytes
94+
95+ if (avaialableBytes < diskSpaceWarningThreshold)
96+ {
97+ String msg = " Less than " + String (diskSpaceWarningThreshold) + " GB of disk space available in " + String (dataDirectory.getFullPathName ());
98+ msg += " . Recording may fail. Please free up space or change the recording directory." ;
99+ AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, " WARNING" , msg);
100+ }
101+ }
102+
84103
85104String RecordNode::handleConfigMessage (String msg)
86105{
@@ -192,6 +211,8 @@ void RecordNode::setDataDirectory(File directory)
192211{
193212 dataDirectory = directory;
194213 newDirectoryNeeded = true ;
214+
215+ checkDiskSpace ();
195216}
196217
197218void RecordNode::createNewDirectory ()
Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ class RecordNode :
160160 /* * Returns the parent directory for this Record Node (can be different from default directory) */
161161 File getDataDirectory ();
162162
163+ /* * Checks if the current recording directory has sufficient space to record */
164+ void checkDiskSpace ();
165+
163166 /* * Returns true if this Record Node is writing data*/
164167 bool getRecordingStatus () const ;
165168
You can’t perform that action at this time.
0 commit comments