PDA

View Full Version : Rename File/Folder



NewsArchive
04-09-2009, 01:46 AM
Hi Friedrich,

Here is another weird one.

I want to rename my shortcut folder from "Icetips Creative" to "Icetips
Alta"

After a lot of trial and error I found that this function always returned 0
until I put the fully qualified path for the "New file/Folder Name" but then
it COPIED the folders, so now I have BOTH folders<g> Not exactly what I was
going for;)

I'm using

%_CSIDL_COMMON_STARTMENU%\Programs\Icetips Creative

as the Old foldername and

%_CSIDL_COMMON_STARTMENU%\Programs\Icetips Alta

as the New foldername. If I just use Icetips Alta as the new name, the
function always returns 0. Rebooting did not fix this.

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
04-09-2009, 01:51 AM
Hi Friedrich,

> After a lot of trial and error I found that this function always returned 0
> until I put the fully qualified path for the "New file/Folder Name" but then
> it COPIED the folders, so now I have BOTH folders<g> Not exactly what I was
> going for;)

Sorry about that. I dropped this code BEFORE I created the shortcuts but
forgot to change the name of the shortcutfolder when creating them so they
were still in Icetips Creative<g>

But the issue with the fully qualified new name is a bit weird. The docs
only specify fully qualified name for the OLD file/folder name, which makes
sense, but it really doesn't make sense to specify the full folder name for
the new one. Does it? Or am I missing something?

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
04-09-2009, 06:18 AM
Hi Arnór,

> But the issue with the fully qualified new name is a bit weird. The
> docs only specify fully qualified name for the OLD file/folder name,
> which makes sense, but it really doesn't make sense to specify the
> full folder name for the new one. Does it? Or am I missing something?

The underlying MoveFile Windows API requires fully qualified names. If you
do not specify a full folder name for the new one, the API fails.

I'll see what we can do in SB7 to optimize this process.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
04-10-2009, 02:02 AM
Hi Friedrich,

> The underlying MoveFile Windows API requires fully qualified names. If you
> do not specify a full folder name for the new one, the API fails.

Then at least it needs to be documented. The docs only say "The new name
for the file or directory" about the New File/Folder Name entry.

> I'll see what we can do in SB7 to optimize this process.

IMO it should be able to figure out if there is a path specified. If not
then it should use the path specified in the Old File. If there is a New
path specified it must match the Old path because otherwise it is copying
not renaming! Or does it allow the file/folder to be moved to a different
destination folder?

Also the docs do not say that you can use variables in the New File/Folder
name, which you obviously can:)

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
04-10-2009, 02:04 AM
Hi Arnór,

> Then at least it needs to be documented. The docs only say "The new name
> for the file or directory" about the New File/Folder Name entry.

I agree.

>> I'll see what we can do in SB7 to optimize this process.
>
> IMO it should be able to figure out if there is a path specified. If not
> then it should use the path specified in the Old File. If there is a New
> path specified it must match the Old path because otherwise it is copying
> not renaming! Or does it allow the file/folder to be moved to a different
> destination folder?

Yes, it allows the file/folder to be moved to a different destination
folder.

> Also the docs do not say that you can use variables in the New File/Folder
> name, which you obviously can:)

Yes, the docs do not explicitly mention this in most (95%) functions because
all the "General Installer Functions" entry fields can handle variables.
Only very few functions have a "You can use variables to build the path
name" note in the documentation. We will remove this note in the SB7
manuals, thank you.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner