# Takes no arguments -- expects to be inside the Make directory,
# or run in place (select all, then cmd-return)

If "{0}" == ""
	Set 0 "{Active}"
End

Set Tree "`Files -f "{0}" | StreamEdit -e '1 Replace /[Â:]*:[Â:]*°/ -n'`"

If {#} == 1
	Set Tree "{1}"
Else If {#} == 0
	Set MyPath "`Files -f "{0}"`"
	Set Tree "`Echo "{MyPath}" | StreamEdit -e '1 Replace /[Â:]*:[Â:]*°/ -n'`"
Else	
	Echo "# USAGE: {0} [PATH]"
	Exit 1
End

Set Count 0

Echo "# Suggested commands:"

For RootFolder in `Files -f "{Tree}" | StreamEdit -e '¥,° Replace /Å:.Å/ -n'`
	For UntypedFile in `Files -f -r -o -s -t '' {RootFolder}`
		Set NewT "TEXT"
		Set NewC "MPS "
		
		If "{UntypedFile}" =~ /Å.x/
			Set NewT "XCOF"
		Else If "{UntypedFile}" =~ /Å.o/
			Set NewT "OBJ "
		Else If "{UntypedFile}" =~ /Å.lib/
			Set NewT "OBJ "
		Else If "{UntypedFile}" =~ /Å.rsrc/
			Set NewT "rsrc"
			Set NewC "RSED"
		Else If "{UntypedFile}" =~ /ÅGoNativeResources/
			Set NewT "rsrc"
			Set NewC "RSED"
		End
		
		Echo "  SetFile -t ¶"{NewT}¶" -c ¶"{NewC}¶" ¶"{UntypedFile}¶""
		
		Set Count `Evaluate {Count} + 1`
	End
End

Echo "# Total: {Count}"
