Renaming a directory

Got a problem you cannot solve? Try here.
Post Reply
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Renaming a directory

Post by Tinus »

Hi Michael,

I need to rename a directory before the windows installer uninstalls a previous version.
All I found was Copy/Move Local Files - but this is based on MSI.
Is there an easy way to accomplish this?
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
crustyzz
Posts: 28
Joined: Thu Mar 16, 2006 4:18 am
Location: France

Post by crustyzz »

Personally I use a Dll.
:?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

There's a very easy way. Use the MoveFile API with Call DLL Function. No need to author a custom DLL or plug-in for this!

Code: Select all

~InstallAware Clipboard Data~
~Call DLL Function~
~{377AD747-17BC-42DE-9AE6-EB7B8A175777}~
~kernel32.dll,MoveFileA,bool,,"pointer to string",c:\\temp,"pointer to string",c:\\temp2,$~
~mIDEFunc.dll\\mEXEFunc.dll~
This renames c:\\temp to c:\\temp2.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post by Tinus »

Michael,

thank you.
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post by Tinus »

This one drives me crazy. Running in the debugger is ok. Running standalone I get an
"unable to load plug-in library. Please rebuild project...".

A few lines above I already use the "call DLL plug-in."
What I'm doing wrong?
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post by Tinus »

After hours of try and error I finally deleted the command and reentered it again manually. And now it works!

The difference is - the GUID!

Code: Select all

~InstallAware Clipboard Data~
~Call DLL Function~
~{974D685E-3C60-4F2A-892E-3035C85DC000}~
~kernel32.dll,MoveFileA,bool,RENAME,"pointer to string",$OLDDBDIR$,"pointer to string",$OLDDBDIR$.1,$~
~mIDEFunc.dll\\mEXEFunc.dll~
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Were you using the same GUID in both commands?
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Tinus
Posts: 209
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Post by Tinus »

No,

I simply cut'n pasted your sample into my script. Then I changed the two directory names.
It was running in the debugger but always failed at runtime.

Then after hours I gave up and deleted the command and reentered it manually again.
It is exactly the same as before but now it's working.

Finally I copied my command to the clipboard and compared my working version with yours.
And the only difference is the GUID.

I don't understand what is wrong here. But I remember that I had a similar problem some days ago.
A copied If command behaved exactly the other way around. I also deleted this and entered it again and it was working.
Martin Rothschink

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Oh, I think the problem is because you pasted the same copied text twice - so both pastes ended up with the same GUID.

I'll be sure to file this as an issue - GUIDs have to be monitored on paste to make sure there aren't any duplicates.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Actually, I was wrong - the IDE is already checking for that, apparently. I really don't know why that's happened on your end, sorry.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
sdeschenes
Posts: 76
Joined: Wed Sep 12, 2007 3:34 pm

Post by sdeschenes »

I just tried using the sample code that MichaelNesmith posted and I get the same error: "unable to load plug-in library. Please rebuild project...". It works when I run it through the debugger. Any more thoughts on this?
sdeschenes
Posts: 76
Joined: Wed Sep 12, 2007 3:34 pm

Post by sdeschenes »

I did what Tinus had mentioned earlier, manually entered the command, and it worked. It is weird that the function would fail if the code was copied from another source and pasted into the script.
Post Reply