Beispiel #1
0
bool AmeJobMan::removeFile(wxString path){
	if(wxRemoveFile(path)){
		wxFileName fn(path);
		return removeDirs(fn.GetPath());
	}
	POSTM(MSG_DEB, SP1("! Failed to remove '%s'. (wxRemoveFile)", path));
	return false;
}
Beispiel #2
0
/**
 * \brief Main loop
 */
void Scanner::loop()
{
	prctl(PR_SET_NAME, "fbitexp:Scanner\0", 0, 0, 0);
	
	std::mutex mtx;
	std::unique_lock<std::mutex> lock(mtx);
	
	MSG_DEBUG(msg_module, "started");
	
	while (!_done) {
		/* 
		 * This is before waiting because we want to check size on startup before 
		 * any scan or add requests
		 */
		if (totalSize() > _max_size) {
			removeDirs();
		}
		
		MSG_DEBUG(msg_module, "Total size: %s, Max: %s, Watermark: %s", 
			sizeToStr(totalSize()).c_str(), sizeToStr(_max_size).c_str(), sizeToStr(_watermark).c_str());
		_cv.wait(lock, [&]{ return scanCount() > 0 || addCount() > 0 || _done || totalSize() > _max_size; });
		
		if (_done) {
			break;
		}
		
		/* Add dirs from queue */
		if (addCount() > 0) {
			addNewDirs();
		}
		
		/* Scan dirs in queue */
		if (scanCount() > 0) {
			rescanDirs();
		}
	}
	
	MSG_DEBUG(msg_module, "closing thread");
}
Beispiel #3
0
bool removeDirs(wxFileName f){
	if(f.DirExists() && f.Rmdir())
		return removeDirs(f.GetPath());
	return true;
}