Could anyone please tell me how to redirect
"C:\Documents and Settings\HOME PC\Application Data\Artweaver" using nsis? because I want those settings to be stored in the "Data" directory of the app, which I am trying to make portable.
thx in advance
edit: because subject was not very clear
Edit 2: I am trying to make my question clearer: how does a portable app handle the program which writes to "application data"? and how does it delete them and then get them to the "data" directory on the USB or so? could someone please show me the code?
You'll have to be very advanced to redirect.
I just do copyfiles then delete (rename doesn't work between drives).
And Backup, also.
Insert original signature here with Greasemonkey Script.
which part of the program launchers does that??? could you please show me the code?
This goes after
CheckForSettings:
And before
LaunchAndExit:
Just remember to fix appname and appnamefolder with the name of the base 'List of Instructions' :P.
Insert original signature here with Greasemonkey Script.
It still does not redirect, I hope you can help me to find the mistake:
Thx for your help
Instead of HKU\{blablabla1234567}\software\blabla, you do HKCU\software\blabla ;).
And change the copyrights to PortableApps.com and Contributors in the !define
I can't figure it out yet :P.
Insert original signature here with Greasemonkey Script.
Once the launcher EXE is created, this is what is written at the end of the compiling process
2 warnings:
label "Backup" not used
label "MoveSettings" not used
For some reason it is ignoring the code you gave me
it just means that you created two labels Backup and MoveSettings but have not used the GOTO statement to jump to them
ok I have used the GOTO statement but still it does not redirect those files
the code now
first of all you dont need Goto Backup and Goto MoveSettings as the labels are just next to the statements you can delete both the label and the statements.
i once made one application portable which wrote to the application data folder
what i did was let the application write all its settings to $APPDATA then when the program exits copy all the files form $APPDATA to $EXEDIR\DATA (
This will make the APPDATA(Application Data) folder be your $EXEDIR\Data folder.
Now for the ArtWeaver App, all the files that are usually written to the APPDATA folder will be written to the $EXEDIR\Data folder
I hope that helps
Please search before posting. ~Thanks
These are the files I want the programm to redirect, I hinbk there is where my problem lies:
C:\Documents and Settings\HOME PC\Application Data\Artweaver\0.4\Brush Settings Cache
C:\Documents and Settings\HOME PC\Application Data\Artweaver\0.4\Plug-In Cache
C:\Documents and Settings\HOME PC\Application Data\Artweaver\0.4\Preview Image Cache
C:\Documents and Settings\HOME PC\Application Data\Artweaver\0.4\Current Session
C:\Documents and Settings\HOME PC\Application Data\Artweaver\0.4\Color Sets.aco
I basically want to redirect the whole folder "artweaver" instead of the folder "0.4" which is where all the other files are located in.
(maybe this is why the codes didn't work??)
but my launcher is able to redirect the registry keys.
(my mean the same way as the other portable launcher do)
try it
Please search before posting. ~Thanks
I tried your code and its the same, it does not redirect the files
the code:
EDIT: I think I misunderstood what your code should do,
should your code only delete the folder created in "application Data"
OR Should your code delete the "Application Data" and then move the files created in there to the data folder of the portableapp?
Actually, so is tipra.wicked:
You have the following
Goto
and label right next to each other, and the label isn't called from anywhere else; they can both be deleted:More importantly, however, powerjuce's code ended up in a place where it won't get executed unless the executable is not found in the default location ($EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}). The code should go right under the
SettingsFound:
label. Also, since you're using both the Data directory (to store %APPDATA%\Artweaver) and Data\settings (for the registry snapshot), I'd recommend you keep them separate. So, replace this:with this:
You'll probably notice a spare
Goto
right above theSettingsFound:
label. If you're adventurous, you can delete the uselessGoto
but leave the label where it is.Don't forget to remove your previous APPDATA logic:
BTW, for the above file-moving logic to work, there has to be a corresponding block of code to move it the other direction before launching the app. There shouldn't be a need to bother with it though -- powerjuce has you covered.
Hope this helps. -hea
<EDIT>
In case you were wondering, setting the %APPDATA% environment variable before launching the app tells it that's where it's supposed to store its stuff. That's why you don't have to worry about moving the files back and forth. If you already have an Artweaver profile in your APPDATA folder and you want to use it, simply use Explorer to drag it to the ArtweaverPortable\Data folder while the application isn't running.
</EDIT>
so if I did it right, what you told me to do, my code looks like this:
this does delete the files created from "application data"
I am getting interested and would like to know how does firefox redirect its files to "data/profile" then?, because I think that wopuld solve my problem
I think it uses a command line parameter at FF. Not Sure.
Insert original signature here with Greasemonkey Script.
firefox takes a parameter called -profile
in the launcher that is wat john uses to redirect the profile
Please search before posting. ~Thanks
I seem to recall saying something along the lines of ...
I haven't checked to see if
Kernel32::SetEnvironmentVariableA
automatically updates NSIS' local copy.If [YES], the above code will move the configuration stuff that you just told Artweaver to save on your portable drive in its default subfolder (Data\ArtWeaver) to a different location (Data\Settings\ArtWeaver). (If that's where you wanted it, it's easier to set the APPDATA variable accordingly and avoid the costly copy-and-delete.) On the next launch of ArtWeaver, it won't find its stuff (because you moved it!) and will probably want to create a new profile again.
If [NOT], the code will move the old saved data from your PC's APPDATA directory to Data\Settings\ArtWeaver on your portable drive (still not where the APPDATA told the app it would be).
Either way, the last two lines check for and potentially rename a file/directory that isn't created or referenced elsewhere in the script. Probably doesn't hurt anything, but it's probably not very useful either.
Now, as far as Firefox and other portable-friendly apps go, some have command-line switches that tell them to store everything they normally would spread out all over your machine (APPDATA, registry, bogus folders under Program Files, etc.) under a single directory that you specify on the command-line. Some apps behave well for files, but leave crap in the regisrty; others automatically switch to an INI or REG file and leave the registry clean, but still leave their files scattered wherever they please. So, the "right" way to handle the app is to get it to be as helpful as it can be and then work around the areas the developers didn't handle.
So, if an app writes to APPDATA and the registry, and has a /portable switch that makes it use INI files instead of the registry, you can probably close the deal by using the APPDATA trick that powerjuce showed you. If an app insists on using the registry, then you have to resort to backing up and restoring the keys that are needed by or clobbered during a run of your portable version.
In Firefox's case, its -profile switch handles both registry behavior and APPDATA, so it's actually very well-behaved. The problem then becomes that Firefox components are TOO aware of where their all-in-one profile directory is. The genius of John's launcher is that it cleans up all the internal URI references and config files whenever you bork them by moving your portable drive and getting assigned a different drive letter.
-hea
I think I just leave it as it is is, but thanks for all your suggestions, codes and help
THANK YOU! @all
THANKS FOR THAT TY TY TY TY TY TY TY TY TY TY TY TY
(ok im done ;))
Na na na, come on!
I just replaced all "$SETTINGSDIRECTORY\Artweaver" which had something to do with moving setting "$SETTINGSDIRECTORY" thatt made the code work, because I think it didnt know where "\Artweaver" was located
to PortableApps.com and Contributors.
And put back the comments in the front (GPL)
Insert original signature here with Greasemonkey Script.
ok I will do that, thx
How would you go about just deleting a folder in ...when it closes?
C:\Documents and Settings\User\Application Data\Avidemux
Lead, Follow, or get out of the way.
At the end put this code in. (replace "PROGRAMMNAME" with your apps name) this will redirect those files to the "Data" directory of the portable app (if you are having the "Data" directory.
This will remoove that direcory of the computer when the launcher exits
(hope it helps) if you need anymore help could you please post the whole code?
well with this i keep getting an error or line 124:CopyFiles /SILENT "$APPDATA\avidemux\*.*" "$SETTINGSDIRECTORY"
In $APPDATA\avidemux there is a folder"custom" and "admlog.txt",folder is empty
do i need to set it to go delete each of those files, or the whole directory? they aren't needed to run or save
settings in avidemux so I don't really need to redirect so much as just delete $APPDATA\avidemux
is there s simpler code to do just that?
My code, based of Tennix!portable:
thank you very much
Lead, Follow, or get out of the way.
The only mistake I found is that you delete the files after the "SecondEnd" Part which means The whole code ends there. (I Think)
You also don't have the "TheEnd" label but direct your label to it to.
Just copy and paste THIS code and try it. If it does not work, please post you code here again.
i used you code exactly and still got nothing
this is the error i get, it still compiles and runs but the $APPDATA doesn't disappear and nothing new in Data
in Avidemux
"4 warnings:
unknown variable/constant "SETTINGSDIRECTORY" detected, ignoring (C:\Documents and Settings\User\Desktop\AvidemuxPortable\Other\Source\AvidemuxPortable.nsi:123)
unknown variable/constant "SETTINGSDIRECTORY" detected, ignoring (C:\Documents and Settings\User\Desktop\AvidemuxPortable\Other\Source\AvidemuxPortable.nsi:125)
label "SetOriginalKeyBack" not used
label "LaunchAndExit" not used"
thanks again
Lead, Follow, or get out of the way.
if you want to know how to move something from $APPDATA look at opera portable that I released, I just used the "Rename" to move from $APPDATA to $SETTINGS because I do not know it environment variable. Oh yeah you can make it so that nothing gets deleted, just moved around. for example you can have appdata go to the DefaultData folder then to $SETTINGS folder and back to DefaultData and back to $APPDATA. I dont know if there is a function that will overwrite the whole folder and files inside, maybe it is CopyFiles /SILENT function.
An eye for an eye makes the whole world blind.
Mahatma Gandhi,
Indian political and spiritual leader (1869 - 1948)
ok thanks, I'm going to do that right now
I'll let you know how it goes
Lead, Follow, or get out of the way.
i figured out why nothing worked, a stupid mistake on my part
there is stuff under $APPDATA, but also , under docs and settings/user, and i was checking there the entire time, and not the $APPDATA folder
you code takes care of the $APPDATA folder, but how can i modify that to take care of Documents and Settings/User/Avidemux
i'm going to start a new post for this here, instead of hijacking this threat further
Lead, Follow, or get out of the way.