views:

37

answers:

2

I am working on a java application that targets both mac and PC. Recently I discovered a strange problem with Windows 7. My application has a projects directory that is not uninstalled by my uninstaller. Recently I uninstalled the application and then manually deleted this projects directory, then reinstalled the application. When I opened an AWT open dialog file chooser inside the application (this file chooser is used to open existing projects), inside the file chooser I could see project directories that existed in the project directory I had deleted but do not exist in the Windows explorer. So for example I had a project called mojo that was in the projects directory I had deleted but was not contained in the projects directory installed by my installer but when going through the file chooser I could see it (it did not show up when looking at it with the explorer).

This problem only occurs on Windows 7 so I assume this must have something to do with virtual directories but this is a topic I am not well versed on so I was wondering if anyone could help me shed a little light onto this problem.

+1  A: 

I think it's not so much a problem of virtual directories as the fact that the Explorer tries to hide "system" files from users to protect them from doing destructive things like wiping out their Windows/System32 folder. Personally and as a programmer, I hate being handheld like that!

Now that I think about it, there is also some kind of magic with "virtual" folders. Explorer shows you some folders in different places from where they really are. It moves some windows directories into your user directory space or vice versa - sorry, I don't remember the details.

I highly recommend getting a file manager that tells you the truth. One reason I'm so badly educated on the intricacies of Win7's Explorer is that I almost never use it. Total Commander leaves you in control of your directory tree while bundling a lot of useful tools. I never leave C: without it.

Carl Smotricz
+1  A: 

Windows Vista and Windows 7 both prevent normal users from writing to the Program Files directory by default. Instead, they redirect writes to the User's AppData\Local\VirtualStore directory.

If this is the case, the easiest solution is... don't write to Program Files, but instead to a user's home directory (the user.home system property can be some help there) or to the location that the user chooses.

Now, the other quirk is that the Windows common file dialogs will not show these files. I'm not sure that the AWT open dialog would either, so it may be something entirely different going on.

R. Bemrose
AWT dialog uses the native OS's dialogs (this is why we use them instead of swing even though they are depreciated). Also, I think I might have explained the situation slightly incorrectly. My application comes bundled with a lot of pre-made projects, the mojo project I was talking about was actually a pre-made project I had included in an earlier version I had made, but had been removed. So this actually does not have to do with users writing to the program files directory. Sorry for the confusion and thanks a lot for your response!
Mike2012
Despite your clarification, I encourage you to investigate file redirection aka file virtualization. Unmanifested code that tries to access Program Files may actually be looking at a per-user folder under AppData. When you cleared out the Program Files location you may not have cleared out the virtual store. See http://www.gregcons.com/KateBlog/FindingFilesYoureSureYouWrote.aspx for a screen shot showing you a button to look for in Windows Explorer to find the virtual store location.
Kate Gregory