Multimobile Development: Building Applications for any Smartphone
problem with the FileSystemWatcher and long file names
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Rade Pusic
Hi,

I have a problem with next code:

FileSystemWatcher watcher = new FileSystemWatcher("c:\\Temp",
"LongFileName.txt");

WaitForChangedResult result =
watcher.WaitForChanged(WatcherChangeTypes.All);

When file name (second argument in FileSystemWatcher constructor) is short
( <= 8+3 characters, 8dot3 format )

or in short format ( LongFi~1.txt, short name generated for non 8dot3
format )

everything works correctly (I get change events),

but when file name is in long format ( > 8+3 characters, non 8dot3 format )
I am not receiving any change events.

Operating system is Microsoft Windows XP with NET CLR version 1.0.3705.209.

Thanks, Rade.

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
NETMaster (VIP)
Problem may be related to:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q290601

(.NET internal uses Win32 ReadDirectoryChangesW )

I guess you have to PInvoke to Win32 GetShortPathName()
for converting long => short (8.3) name ...

--
NETMaster (Thomas Scheidegger)
http://www.cetus-links.org/oo_csharp.html

"Rade Pusic" <Click here to reveal e-mail address> wrote in message news:ac2qrj$2dtm$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.IO.FileSystemWatcher
System.IO.WaitForChangedResult
System.IO.WatcherChangeTypes




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734