View Full Version : Strange problem!
danfloun
02-13-2005, 01:34 PM
Hi
I'm trying to copy a primer file to the windows folder. However something strange is happening. If the file already exists it deletes the file without making a backup even though its set to make one.
But, if the file doesn't exist to start with, it doesnt copy the file over. If I turn off make a backup, then it installs the file to the windows folder ok.
I need it to make a backup though. Here's the code I'm using.
osresult = System.GetOSName();
if osresult == "Windows XP" then
File.Install(SessionVar.Expand("%TempLaunchFolder%\\example.ini"), "%WindowsFolder%\\example.ini", FILE_INSTALL_ALWAYS, true, true);
end
So whats happening. Thanks
Danny Please help, knowones helped so far with my posts.
Absynthe
02-13-2005, 02:28 PM
The only thing I see wrong is a syntax error in the destination. Try this and see if it works.
File.Install(_TempLaunchFolder.."\\example.ini"), _WindowsFolder.."\\example.ini", FILE_INSTALL_ALWAYS, true, true);
csd214
02-13-2005, 03:34 PM
danfloun,
Why do you tell SUF70 that example.ini is a shared system file? [Set to false]
You should use the result variable feature and test the result.
Absynthe has already told that you must use the build-in variable (or expand the session variable). You can never use a session variable as a regular variable.
It's a good idea to add some error handling
bInstalled = File.Install(SessionVar.Expand("%TempLaunchFolder%\\example.ini"),
_WindowsFolder.."\\example.ini", FILE_INSTALL_ALWAYS, false, false);
nError = Application.GetLastError();
if nError~= 0 then
-- some kind of error has occurred!
Dialog.Message("Error "..nError, "File install error: ".._tblErrorMessages[nError]);
end
if bInstalled then
Dialog.Message("", "Yes, installed");
else
Dialog.Message("", "No, not installed");
end
There seems to be a bug when you set CreateBackup = true!
danfloun
02-13-2005, 03:48 PM
Hi,
thanks for your help.
I've tried the code suggested to no avail, it does exactly the same.
File.Install(SessionVar.Expand(_TempLaunchFolder.."\\example.ini"), _WindowsFolder.."\\example.ini", FILE_INSTALL_ALWAYS, true, false);
I can't work it out. If! the file exists, it dissapears after running the sf7.0 exe and it doesn't backup. If the file doesn't exist, it still doesn't create it untill I turn off 'backup
?.
Absynthe
02-13-2005, 03:55 PM
Sounds like a bug, looks like you willl have to check for the file and rename it yourself.
SUF6NEWBIE
02-14-2005, 07:36 AM
Yep, I can confirm this behaviour at my end also
(also tried the numeric constant of (2) instead of the 'verb'
makes no difference.
The same issue is evident in AMSPro 5020
danfloun
02-14-2005, 08:49 AM
Yep, I can confirm this behaviour at my end also
(also tried the numeric constant of (2) instead of the 'verb'
makes no difference.
The same issue is evident in AMSPro 5020
Thanks SUF6NEWBIE
For that info, I'll back up the file manually instead.
Can the admin post this in BUGS please. Thx
Corey
02-14-2005, 09:05 AM
Hi, there's a reference to it in there, so it should get picked up no problem. :yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.