I know the following code for redirecting the 'userprofile'.
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("USERPROFILE", "$SETTINGSDIRECTORY\UserProfile").r0'
But I wonder if there will be anyway of redirecting other system folders.
Like the following folders:
'Cookies', 'Local Settings' or even 'Temporary Internet Files' and 'History'
I have tried all sorts of combinations, but nothing seems to do the trick as 'USERPROFILE' does !
And we don't use USERPROFILE because it has unintended consequences. It breaks the open/save dialogs that have the Desktop icon on the left. And any apps launched from the packaged app will carry that USERPROFILE, so you can wind up with lots of other stuff redirected.
We only use it in a couple small apps that have no ability to open/save/browse or call other apps. Like Sudoku Portable, for example.
Sometimes, the impossible can become possible, if you're awesome!
But for the winamp browser to be portable, without leaving traces, I need to some how to redirect the cookies, temporary internet files, and probably history.
About Winamp launching other apps, all I remember for now it does launch is internet explorer!
Would you know a different way of portabilizing this browser in Winamp, or do you think it isn't a problem to leave these traces ?
Formerly Gringoloco
Windows XP Pro sp3 x32
yes. Use the same sort of code to redirect those individual folders.
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
As far as I know, no-one here has worked out a decent way of clearing cache - that's part of the reason that RSSOwl hasn't gone official, as it uses Internet Explorer as its internal browser, but still leaves everything in its cache behind.
If it requires and uses Internet Explorer, we're stymied.
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
I have been playing around with the problem of the above code, and found a kind of solution !
The following code moves(backs up) the Desktop value which consists a relative path '%USERPROFILE%\Desktop', then writes the same path but absolute, in my case 'C:\Documents and Settings\Gringoloco\Desktop'. Then changes the environment variable, followed by an immediate restore of the original Desktop value! When my script executed Winamp after this code, Winamp could find the desktop without a problem, but still had the (Winamp) browser saving it's cookies and temporary internet files to the Data\UserProfile folder.
Probably (hopefully) this could work for all system folders affected by %USERPROFILE% !
It does the trick for windows XP, but I would need a little help to make this work for Vista and Windows 7 !!!
Formerly Gringoloco
Windows XP Pro sp3 x32
I have a feeling this is working by sheer luck, and is certainly not a method to be relied upon. Apps can get profile directories in at least 3 different ways - query the environment, read the registry, explicit API calls. Ideally apps should only use one method. Sounds like Winamp is using a combination (bad programming IMO).
That could change at any time, of course, and break your portability. Also you cannot guarantee other apps get profile directories in the same way.
But it seems to me that this is a way of getting the Desktop folder to not be included in the redirection of the USERPROFILE for solely Winamp.exe (and any other app what will be executed from within Winamp), but this way the rest of windows doesn't seem affected !
Give it a try!
Formerly Gringoloco
Windows XP Pro sp3 x32
That's a high explosive device. Don't touch it or you may get blown up.
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
Ok, done some more testing, and 'strangely' enough after a reboot I can't get it to behave the way it did for me before. But, maybe there is a chance this could actually lead to something. Don't you think it got potential ?
There must have been a reason, after all the tweaking I tried before, it did actually work perfectly..... till I did my reboot ! Winamp still finds the real Desktop, but started giving the error message again
Yes I am using a frozen harddisk anyway, so I'm not scared to destroy my registry. But getting blown up ???
Formerly Gringoloco
Windows XP Pro sp3 x32
I mean what I say, don't touch it. You could really screw a system up that way. And I doubt that the user would like that.
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
If you say this won't lead to anything, I won't touch it anymore.
Will find another solution......
Maybe just a shortcut to the desktop, like this Data\UserProfile\Desktop\Desktop.lnk
This will also get rid of the error message, and keeps a link to the desktop. Just have to get the launcher to update the path in this link.
Changing userprofile, without the error message, do you think that will be good enough for an 'official release' ? (one day)
Formerly Gringoloco
Windows XP Pro sp3 x32
We don't touch USERPROFILE on anything like that. Something like Sudoku, or SuperTux, or some other game which does nothing like file or directory picking or spawning processes, would be as far as we'd go.
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1