userlibandfileserver/fileserver/sfile/sf_notifier_handlers.cpp
changeset 300 1d28c8722707
parent 31 56f325a607ea
equal deleted inserted replaced
293:0659d0e1a03c 300:1d28c8722707
   259 		{
   259 		{
   260 		return r;
   260 		return r;
   261 		}
   261 		}
   262 	
   262 	
   263 	if(path.Length() >= 2)
   263 	if(path.Length() >= 2)
   264 		r=PathCheck(aRequest,path.Mid(2),&KCapFsSysFileTemp,&KCapFsPriFileTemp,&KCapFsROFileTemp, __PLATSEC_DIAGNOSTIC_STRING("Notification Add Filter"));
   264 		r=PathCheck(aRequest->Message(),path.Mid(2),&KCapFsSysFileTemp,&KCapFsPriFileTemp,&KCapFsROFileTemp, __PLATSEC_DIAGNOSTIC_STRING("Notification Add Filter"));
   265 	return r;
   265 	return r;
   266 	}
   266 	}
   267 
   267 
   268 TInt TFsNotificationAdd::DoRequestL(CFsRequest* aRequest)
   268 TInt TFsNotificationAdd::DoRequestL(CFsRequest* aRequest)
   269 	{
   269 	{
   282 		return r;
   282 		return r;
   283 	
   283 	
   284 	__PRINT2(_L("TFsNotificationAdd::AddNotification() path=%S, filename=%S"),&path,&filename);
   284 	__PRINT2(_L("TFsNotificationAdd::AddNotification() path=%S, filename=%S"),&path,&filename);
   285 	
   285 	
   286 	//If this is a path starting with 'drive-letter:'
   286 	//If this is a path starting with 'drive-letter:'
   287 	TInt driveNum = FsNotificationHelper::DriveNumber(path);
   287 	TInt driveNum = CFsNotificationInfo::DriveNumber(path);
   288 	if(path.Length() >= 2 && (driveNum < 0 || driveNum > 25) && ((TChar)driveNum)!=((TChar)'?') && ((TChar)path[1])==(TChar)':')
   288 	if(path.Length() >= 2)
   289 		{
   289 	    {
   290 		return KErrPathNotFound;
   290 	    if(path[1] != (TText)':')
   291 		}
   291 	        {
       
   292 	        if(path[0]!=(TText)'*')
       
   293 	            {
       
   294 	            return KErrPathNotFound;
       
   295 	            }
       
   296 	        }
       
   297 	    else // 2nd char is ':' 
       
   298 	        {
       
   299 	        if(driveNum < EDriveA  || driveNum > EDriveZ)
       
   300 	            {
       
   301 	            if(path[0]!=(TText)'?')
       
   302 	                return KErrPathNotFound;
       
   303 	            }
       
   304 	        }
       
   305 	    }
   292 
   306 
   293 	CleanupStack::PushL(notifyRequest);
   307 	CleanupStack::PushL(notifyRequest);
   294 	CFsNotificationPathFilter* filter = CFsNotificationPathFilter::NewL(path,filename);
   308 	TPtrC pathPtr(path);
       
   309 	if(driveNum!=KErrNotFound || ((path.Length() >=1) && path[0]=='?'))
       
   310 	    //Remove the drive: part of the the path if it's got one.
       
   311 	    pathPtr.Set(path.Mid(2));
       
   312 	CFsNotificationPathFilter* filter = CFsNotificationPathFilter::NewL(pathPtr,filename,driveNum);
   295 
   313 
   296 	//Bitmask of filter types
   314 	//Bitmask of filter types
   297 	TUint filterMask = (TUint) aRequest->Message().Int0();
   315 	TUint filterMask = (TUint) aRequest->Message().Int0();
   298 	
   316 	
   299 	r = notifyRequest->AddFilterL(filter,filterMask);
   317 	r = notifyRequest->AddFilterL(filter,filterMask);