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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |