quorsum

New Member
Joined
Sep 13, 2010
Messages
10
hello

I have an application with the user data in a set subfolder.

After entering and saving the data file, windows 7 writes it to some sub sub sub ....folder that has nothing to with the one where my files are stored and the original files are not modified.

When searching, this files are found in above mentioned sub sub sub.... folder, however, no such folder seems to exist when trying to look it up in the explorer.

It works perfectly in XP and I just cannot find a solution to this problem.


Any help is much appreciated.
 
Solution
Thanks for your info. I better refrain from uttering my opinion about M$.

It's a unique sort of pehenomenon with Win7. People seem reluctant to see it's foibles and some will even leap to defend it. There's at least 2 forums I don't post to anymore because people got all bent out of shape when I pointed out a couple of serious weaknesses. This may be a "new generation" thing but with XP we saw both strengths and weaknesses and often discussed the weaknesses as a means of educating consumers... But don't try that with Win7, you'll get your head chewed off... Go figure.


In my case, the subfolder is created in the installation and the data files are still redirected.

Yep, that would be normal behavior... if you look...
No, it was not in a temp folder, but I can not remember the exact path.

Trouble is, now the search does not find any file in question anymore, except the ones in my subfolder. The program accesses these at the first startup only. The modified files are there somewhere, the program works and clearly does save them properly, but bugger if I can find where they are.

If I delete the original files (.db) after saving, there is no "file not found" as there should be.
 
Does the application, by chance, try to save it's data under it's folder in Program Files?

If so Win7 will redirect it to a virtual folder. The app will theoretically be unaware of this, but it is a major pain in the backside.


That is exactly the case!

If I install my program direct under C:\ everything works as it should.

What the heck was MS thinking doing this, snagging us developpers with such a nonsense!

Is there any trick to overcome this at all?

Thanks for your help.
 
What the heck was MS thinking doing this, snagging us developpers with such a nonsense!

It's a long story and I'm not exactly sure my opinions would be well received in this context. However, I do believe there is a systematic attack on Shareware and Freeware develpers in all this. Many of the decisions --especially very expensive code signing methods-- place smaller software companies and freelance developers at profound disadvantage as software develpment becomes more and more complex with each new generation of windows.

I work mainly in C-99 and with each new generation of windows there's more and more stuff I can't access, pressing me to upgrade to .NET and C++, both of which produce monumentally bloated softwares. Things I used to do in 100k now asks me to consume megabytes of code, most of which is basically inert throughout the execution of the program. Using the .NET framework, for example, incorporates close to 200k of start up code into every program.

With Win7, Microsoft has introduced the new dynamic of isolating code from data. Although this is not entirely a bad thing there are many cases where it leads to much more complex code as now you must allow for highly variable data locations in each file you create. This is fine for an editor or data base app, but it's a major pain for settings and add-ins. As soon as you create a sub-folder under the program's own folder, other than at install time, it is redirected. You can can overcome this to some extent by including an appropriate Manifest in your program resources but it's still there.

The new right place for data is exposed by %homepath% which is the same as clicking your user name in the start menu.

The shat in this is that now your code has to be OS version aware. Of course this means extensive re-writing of older code that happily used the GetCurrentDirectory call to store their data. But it also means that backups are simpler having a single point source for recursive folder actions.

Of late I've been working on a couple of projects --well one rather complex one, with many parts, actually. I cobbled the original "test version" together under XP in a few days. Now, almost a year later, I'm still trying to get the behaviors I need under Win7 without constant nags from UAC and all the bizarre permission issues that go with it. Oddly enough, it's Win7's so called "security" that I am most often defeating to get things done; things I did with complete ease in XP.

Sometimes I really do wish they'd continued development on the Win2k codebase instead of switching to the Vista one... Life was a lot simpler back then.
 
Last edited:
Thanks for your info. I better refrain from uttering my opinion about M$.


As soon as you create a sub-folder under the program's own folder, other than at install time, it is redirected.


In my case, the subfolder is created in the installation and the data files are still redirected.
 
Thanks for your info. I better refrain from uttering my opinion about M$.

It's a unique sort of pehenomenon with Win7. People seem reluctant to see it's foibles and some will even leap to defend it. There's at least 2 forums I don't post to anymore because people got all bent out of shape when I pointed out a couple of serious weaknesses. This may be a "new generation" thing but with XP we saw both strengths and weaknesses and often discussed the weaknesses as a means of educating consumers... But don't try that with Win7, you'll get your head chewed off... Go figure.


In my case, the subfolder is created in the installation and the data files are still redirected.

Yep, that would be normal behavior... if you look you'll probably find the sub folder is read only.

If you have source code level access to the app your best bet is to patch it so that the user can set their own data folder location. You can recommend something like %homepath%\<this program> in the new dialog if you like and of course you would create the folder for them... but it is no longer accepable to put data files in the program files folders.
 
Last edited:
Solution