Old 15th February 2007, 13:23   #1
kristoff333
Junior Member
 
Join Date: Feb 2007
Location: Antwerpen, Belgium
Posts: 2
Copy file name truncated

Hi,

Following code extract produces two errors on my system:
code:

!define PRODUCT_BACKGROUND_ORIG "background_mon.jpg"
!define PRODUCT_BACKGROUND "background.jpg"

Section "Application" SEC01
StrCmp "${PRODUCT_BACKGROUND_ORIG}" "${PRODUCT_BACKGROUND}" +2
CopyFiles "${PRODUCT_BACKGROUND_ORIG}" "${PRODUCT_BACKGROUND}"
Delete "${PRODUCT_BACKGROUND_ORIG}"
SectionEnd


1) The destination file name gets truncated to "backgrou.jpg" (and a second time to "backgrou (2).jpg"): the base name appears to be only eight bytes long.
2) The original file is not deleted. I don't manage to delete any file in the destination directory.

What am I overlooking?
Thanks for your help!

Kristoff
kristoff333 is offline   Reply With Quote
Old 15th February 2007, 14:10   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Why are you using StrCmp? To see if the path exists? If so, try IfFileExists.

Also, never extra to say, try use full paths in CopyFiles.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 15th February 2007, 14:35   #3
kristoff333
Junior Member
 
Join Date: Feb 2007
Location: Antwerpen, Belgium
Posts: 2
Smile

Hey, adding the path solves all these file related issues! I corrected the code with Joel's suggestion, and after success did the same in a cleaner way by renaming instead of copying.
Now the action in the code looks like this:
code:

StrCmp "${PRODUCT_BACKGROUND_ORIG}" "${PRODUCT_BACKGROUND}" +2
Delete "$INSTDIR\${PRODUCT_BACKGROUND}"
Rename "$INSTDIR\${PRODUCT_BACKGROUND_ORIG}" "$INSTDIR\${PRODUCT_BACKGROUND}"



The StrCmp function is used for performing the action only if the two file names differ from each other, and I delete a possible former installed target file before renaming the original file to the target file.
With this strategy I choose one file (= PRODUCT_BACKGROUND_ORIG) from an available set of files to be installed as the specified target file (= PRODUCT_BACKGROUND).

Thanks Joel!
Kristoff
kristoff333 is offline   Reply With Quote
Old 15th February 2007, 19:38   #4
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
No problem


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump