Hi all, I'm new to PerlMonks and hope you can help me with a problem.

I make a Swedish localization and Installers for a program for Mac and Win. This issue concerns Mac. After the user updates the app, it updates older files in User's directory when the app is launched. However, the app doesn't update these files in the Swedish version.

The solution to this was to make an addition to a post-install script that backs up the older User's files to the desktop directory (in case the user had made any changes to these files) and then erases them from the user's directory. In that case, the app copies the missing files from Library/Application Support directory to the User's/Library/Application Support directory.

For the previous version this addition worked but for the present, it doesn't. Something is wrong with the script and I can't figure it out. The output is that the script doesn't back up. Everything else in the script works.

The part of the script looks like this:

#!/usr/bin/perl use version $APPSUPPORT_PATH="/Library/Application Support/MakeMusic/Finale"; $PKG_RECORD_PATH="/Library/Application Support/MakeMusic/Finale/Instal +lerComponents/FinaleAppCore"; $PKG_RECORD_VERSION="25.0.0.0"; $PKG_RECORD_FAILURE_MESSAGE="Failed writing package record."; $REWIRE_SUPPORT_PATH="/Library/Application\ Support/Propellerhead\ Sof +tware/ReWire"; $REWIRE_TEMP_SUPPORT_PATH="/Library/Application\ Support/Propellerhead +\ Software/ReWire/Finale\ Install\ Temp"; $REGFILE_PATH="/Library/Application Support/MakeMusic/.regdata25.txt"; $REGFILE_FAILURE_MESSAGE="Failed writing version 25 file."; $QUICKLOOK_PATH="/Applications/Finale.app/Contents/Library/QuickLook/F +inale.qlgenerator"; $SPOTLIGHT_PATH="/Applications/Finale.app/Contents/Library/Spotlight/F +inale64.mdimporter"; ###################################################################### +########## # # Move Swedish User's files so app will update those files # ###################################################################### +########## ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time +); $year = $year + 1900; $mon = $mon + 1; $timeStampString = sprintf("%04u.%02u.%02u_%02u.%02u.%02u", $year, $mo +n, $mday, $hour, $min, $sec); $userFileBackupDir = $ENV{"HOME"}."/Desktop/Finale User Backup/".$PKG_ +RECORD_VERSION."_Backup_".$timeStampString; foreach $relativeFilePath (@MOVE_USER_FILES_FOR_UPDATES) { $existingPath = $ENV{"HOME"}."/".$relativeFilePath; print "checking: $existingPath\n"; if ( -e $existingPath ) { $backupPath = $userFileBackupDir."/".$relativeFilePath; makeDirAtPath_(parentDirOfPath_($backupPath)); print " moving: $backupPath\n"; rename($existingPath, $backupPath); } }

If nessecary, I'll add the rest of the script.

Thank's, I'm greatful for your help.

/peli


In reply to Backup User's files by peli

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.