home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Temp / QuickProject / copy_project < prev    next >
Encoding:
Text File  |  1994-09-15  |  1.6 KB  |  71 lines

  1. #!/bin/sh
  2. # copy_project  templatePath destPath templateName destName iconFile 
  3. PATH=/usr/ucb:/bin:/usr/bin export PATH
  4.  
  5. template=$1
  6. destdir=$2
  7. tname=$3
  8. name=$4
  9. icon=$5
  10.  
  11. echo Copying template from $template to $destdir ...
  12. cp -r $template $destdir
  13. cd $destdir
  14.  
  15. # OK we have to do change templateName to destName in various files
  16. # in the destination directory.
  17.  
  18. # 1) Fix up the .iconheader file
  19.  
  20. echo Fixing $tname.iconheader ...
  21. sed -e "s/$tname/$name/g" <$tname.iconheader >$name.iconheader
  22. rm $tname.iconheader
  23.  
  24. # 2) Fix up the _main.m file
  25.  
  26. echo Fixing ${tname}_main.m...
  27. sed -e "s/$tname/$name/g" <${tname}_main.m >${name}_main.m
  28. rm ${tname}_main.m
  29.  
  30. # 3) Rename the main nib file
  31. # Note that the main menu title in the nib template file should be
  32. # "UNTITLED"; IB changes this to be the same as the name of the nib.
  33.  
  34. echo Fixing $tname.nib...
  35. mv English.lproj/$tname.nib English.lproj/$name.nib
  36.  
  37. # 4) Fix up the Makefile
  38.  
  39. echo Fixing Makefile...
  40. sed -e "s/$tname/$name/g" <Makefile >Makefile.new
  41. mv Makefile.new Makefile
  42.  
  43. # 5) Set the icon
  44.  
  45. case "$icon" in
  46. "")    ;;
  47. *)
  48.     echo Copying icon...
  49.     cp $icon icon.tiff
  50.     # PB.project may already contain APPICON=foo.tiff - but it might not
  51.     # be there.
  52.     if grep -s APPICON PB.project ; then
  53.     sed -e 's/^APPICON=.*$/APPICON=icon.tiff;/' <PB.project >PB.project.new
  54.     mv PB.project.new PB.project
  55.     else
  56.     echo "APPICON=icon.tiff;" >>PB.project
  57.     fi
  58.     
  59. esac
  60.  
  61.     
  62. # 6) And finally, fix up the PB.project
  63.  
  64. echo Fixing PB.project...
  65. sed -e "s/$tname/$name/g" <PB.project >PB.project.new
  66. mv PB.project.new PB.project
  67.  
  68. echo Copied succesfully.
  69.  
  70. exit 0
  71.