I’d like to unlock a compiled nib so it can be edited in Interface Builder. This requires adding 2 dummy files (“classes.nib” & “info.nib”) into the Package Contents of the nib file. This works fine manually…
BUT an applescript to automate the process is failing. How do I tell Finder to duplicate the dummy files into the Package Contents? It’s treating the nib as a file, not a folder???
Getting error: “Error: -1700. Finder got an error: Can’t make alias “*Macintosh:Users:alnoor:Desktop:BasicWindows.nib:” into type folder.”
Basic, I know, but it’s stumping me!
Details below…
The applescript is saved as an app with dummy files copied into Contents/Resources:
--"unlock nib" v1
--save as app
--requires files "classes.nib" & "info.nib" in Contents/Resources
-----------------------------------------------
set file1 to "classes.nib" as text
set file2 to "info.nib" as text
display dialog "unlock nib?" & return & return & "choose a compiled nib to open with Interface Builder:" buttons {"Cancel", "Choose Nib"} default button 2 with icon 1
tell application "Finder"
set target_file to (choose file of type {"nib"}) as text
try
duplicate file (((path to me) as text) & "Contents:Resources:" & file1) to target_file as alias
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1 with icon 0
end try
end tell
The dummy file contents are:
classes.nib
'<?xml version="1.0" encoding="UTF-8"?>
'info.nib
'<?xml version="1.0" encoding="UTF-8"?>
'