By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,583 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

FileSystemWatcher case bug

P: n/a
I'm running into a problem where the FSW events report all filenames in
lower case. (The directory portion is okay, just the leaf file name is
broken.)
I found this thread from 6/02 stating as such, and a reply presenting a
workaround.
However, creating a DirectoryInfo or FileInfo object with the path and
asking for the Name or FullName still reports the lower case version, not
the correct user case.

Any ideas short of opening the file's or folder's parent dir, enumerating
all the files, comparing w/o case, and returning the matching entry? (Not
that's it's hard, just hoping for a better way...)

thanks,
mike

..Net 1.1.4372
---------------------
Here is the fix for that bug

Pass the FullPath into the Constructor of a DirectoryInfo Class and Read the
Name Property.
--
Joe Feser
"Michael" <Mi*****@nowhere.com> wrote in message
news:eySuyptHCHA.2012@tkmsftngp13...
Is there an official place to submit this bug?

I'm not sure which of the two classes would be the source of the problem.
"System.IO.FileSystemEventArgs" or "System.IO.FileSystemWatcher"

to recreate:
1) Initialize a "System.IO.DirectoryInfo" instance to a folder name that has capital letters.
IE.
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\New
Folder");
2) create the directory...
dir.Create();
3) create a "FileSystemWatcher" object to monitor the location where you
create the new folder.
4) in the Created event handler for the "FileSystemWatcher", examine the
"FileSystemEventArgs", property "FullPath" or "Name". You'll notice that
replaces all characters in the newly created portion of the "FullPath" with lower case letters.

Now when you display the name in a listview, it is forced to lower case. I
know this is going to annoy my users.


Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I have had no end of problems with this. I have seen the case problem. If
I run from a service I get different results than a windows app.

I have a database that hold the name coming from Directory.GetFiles and that
is different than what is returned. For a new API dot.net is one screwed up
set of routines.
"Mike" <vi********@yahoo.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
I'm running into a problem where the FSW events report all filenames in
lower case. (The directory portion is okay, just the leaf file name is
broken.)
I found this thread from 6/02 stating as such, and a reply presenting a
workaround.
However, creating a DirectoryInfo or FileInfo object with the path and
asking for the Name or FullName still reports the lower case version, not
the correct user case.

Any ideas short of opening the file's or folder's parent dir, enumerating
all the files, comparing w/o case, and returning the matching entry? (Not
that's it's hard, just hoping for a better way...)

thanks,
mike

.Net 1.1.4372
---------------------
Here is the fix for that bug

Pass the FullPath into the Constructor of a DirectoryInfo Class and Read the Name Property.
--
Joe Feser
"Michael" <Mi*****@nowhere.com> wrote in message
news:eySuyptHCHA.2012@tkmsftngp13...
Is there an official place to submit this bug?

I'm not sure which of the two classes would be the source of the problem. "System.IO.FileSystemEventArgs" or "System.IO.FileSystemWatcher"

to recreate:
1) Initialize a "System.IO.DirectoryInfo" instance to a folder name that

has
capital letters.
IE.
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\New
Folder");
2) create the directory...
dir.Create();
3) create a "FileSystemWatcher" object to monitor the location where you
create the new folder.
4) in the Created event handler for the "FileSystemWatcher", examine the
"FileSystemEventArgs", property "FullPath" or "Name". You'll notice that replaces all characters in the newly created portion of the "FullPath"

with
lower case letters.

Now when you display the name in a listview, it is forced to lower case. I know this is going to annoy my users.


Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.