home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR8 / TCD11.ZIP / TCD.S < prev    next >
Text File  |  1993-06-05  |  1KB  |  44 lines

  1. // TCD.S  05/21/1993  06/05/1993
  2. // by Richard Hendricks
  3.  
  4. // Version 1.0 - 05/21/1993  Used DOS( CD,..) to change directory
  5. // Version 1.1 - 06/05/1993  Uses Richard Blackburn's change directory BIN
  6.  
  7. binary ['dirchng.bin']        // Written by Richard BlackBurn / SemWare Corporation
  8.     integer proc cd(string dir):0
  9. end
  10.  
  11. proc MAIN()
  12.   integer dirID, cmdID
  13.   string cmdFname[128] = GetEnvStr( "MACPATH" )+"tcd.tmp"
  14.   string gotoDIR[128] = "",
  15.          userDIR[128] = ""
  16.  
  17.   ClrScr()
  18.   Message( "The Semware Editor Directory Changer ■ TCD ■ Version 1.1" )
  19.   dirID = GetBufferID()
  20.  
  21.   cmdID = EditFile( cmdFname )
  22.   userDIR = GetText( 1, sizeof( userDIR ) ) // Unchanged/Original Request
  23.   BegFile()
  24.   LReplace( "*", ".@", "n" )  // DOS *'s to TSE Regular Expression: .@ 0 or more any character
  25.   BegFile()
  26.   LReplace( "?", ".", "n" )   // DOS ?'s to TSE Regular Expression: any character
  27.   BegFile()
  28.   LReplace( "\", "\\", "n" )  // DOS \ to TSE Regular Expression: \\
  29.   BegFile()
  30.   gotoDIR = GetText( 1, sizeof( gotoDIR ) )
  31.  
  32.   GotoBufferID( dirID )
  33.   gotoDIR = iif( gotoDIR[1] <> "\" and not pos( ":", gotoDIR ), "\\", "" ) + gotoDIR
  34.   if LFind( gotoDIR, "IX" )
  35.     gotoDIR = GetText( 1, sizeof( gotoDIR ) )
  36.     cd( gotoDIR + Chr(0) )                  // Calls DIRCHNG.BIN
  37.     LogDrive( SplitPath( gotoDIR, _DRIVE_ ) )
  38.   else
  39.     warn( "'"+userDIR+"' wasn't found" )
  40.   endif
  41.   AbandonEditor()
  42. end MAIN
  43. // end-of-file TCD.S
  44.