Renaming a directory

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

Renaming a directory

Postby Tinus » Thu Jul 13, 2006 4:41 am

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
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

crustyzz
Posts: 28
Joined: Thu Mar 16, 2006 4:18 am
Location: France

Postby crustyzz » Thu Jul 13, 2006 7:14 am

Personally I use a Dll.
:?

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Jul 13, 2006 7:40 am

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
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Postby Tinus » Thu Jul 13, 2006 7:52 am

Michael,

thank you.
Martin Rothschink
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Postby Tinus » Thu Jul 13, 2006 11:00 am

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
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Postby Tinus » Thu Jul 13, 2006 3:16 pm

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
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Jul 13, 2006 7:53 pm

Were you using the same GUID in both commands?
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Postby Tinus » Fri Jul 14, 2006 12:59 am

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
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Fri Jul 14, 2006 7:10 am

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

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Fri Jul 14, 2006 7:29 am

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

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

sdeschenes
Posts: 76
Joined: Wed Sep 12, 2007 3:34 pm

Postby sdeschenes » Thu Sep 13, 2007 2:21 pm

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

Postby sdeschenes » Fri Sep 14, 2007 10:54 am

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.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 72 guests