home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-23 | 2.0 KB | 68 lines | [TEXT/MPS ] |
- # DirMenu - Set up the MPW directory menu they way I want it
- # All directories of the form ≈:Development:≈ are added
- # Directories of the form ≈:Development:Others:≈ are appended hierarchically
- # Hierarchical menus need the DemoteMenu and SetSubMenu tools available
- # on the Developer's CD series and the commands are not executed, but written
- # to a file {MPW}MPW.HierStuff.
-
- Set Echo 0
- Set Exit 0
- DeleteMenu Directory ≥ Dev:Null
- AddMenu Directory 'Show Directory' ∂
- '(Echo "The default directory is ∂n"; Directory) | Alert -s'
- AddMenu directory 'Set Directory…' ∂
- 'set __OldExit__ "{exit}"; ∂
- unset exit; ∂
- Set __Directory__ "`GetFileName -d; set __tmpStatus__ "{status}"`"; ∂
- if "{__tmpStatus__}" == 0; ∂
- SetDirectory {__Directory__} > "{ShellDirectory}"MPW.Errors ≥ Dev:StdOut; ∂
- if "{status}" != 0; ∂
- Alert < "{ShellDirectory}"MPW.Errors; ∂
- end; ∂
- end; ∂
- set exit "{__OldExit__}"; ∂
- unset __Directory__ __OldExit__ __tmpStatus__'
- AddMenu Directory '(-' ''
- Set Exit 1
- Perl -Sx "{0}" ≈:>"{MPW}TmpMDEFS" && Execute "{MPW}TmpMDEFS" && Delete -y "{MPW}TmpMDEFS"
- Exit 0
- #
- # Now for the Perl part
- #!/usr/local/bin/perl
-
- $MPW = $ENV{'MPW'};
- $hi = $MPW . "MPW.HierStuff";
- open(HIER, ">>$hi") || die "Could not open $hi";
-
- foreach $vol (@ARGV) {
- $dev = $vol . "Development";
- next unless -d $dev;
-
- opendir(DEV, $dev) || die "Couldn't open $dev";
- while ($dir = readdir(DEV)) {
- next unless (-d "$dev:$dir");
-
- print <<END;
- AddMenu Directory \'$vol$dir\' ∂
- \'Directory \"$dev:$dir\" > \"{ShellDirectory}\"MPW.Errors ≥ Dev:StdOut ∂
- || Alert < \"{ShellDirectory}\"MPW.Errors\'
- END
-
- next unless $dir eq "Others";
-
- opendir(OTH, "$dev:$dir") || die "Couldn't open $dev:$dir";
- while ($od = readdir(OTH)) {
- print <<END;
- AddMenu \"$vol$dir\" \'$od\' ∂
- \'Directory \"$dev:$dir:$od\" > \"{ShellDirectory}\"MPW.Errors ≥ Dev:StdOut ∂
- || Alert < \"{ShellDirectory}\"MPW.Errors\'
- END
- }
-
- print HIER <<END;
- DemoteMenu \"$vol$dir\"
- SetSubMenu Directory \"$vol$dir\" \"$vol$dir\"
- END
- }
- }
-