home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / C_PLUS / CNVLIB2 / UPFOLDER.CMD < prev    next >
Encoding:
Text File  |  1994-08-15  |  800 b   |  34 lines

  1. EXTPROC CEnvi
  2.  
  3. #include <PMdll.lib>
  4.  
  5. main(argc,argv)
  6. {
  7.    if ( 2 < argc )
  8.       return EXIT_FAILURE;
  9.  
  10.    CurDir = ( argc == 2 ) ? argv[1] : FullPath(".") ;
  11.  
  12.    if ( !strcmp(CurDir+1,":\\") )
  13.       // already at root directory
  14.       return EXIT_FAILURE;
  15.  
  16.    // go up one directory and open that folder
  17.    LastBackslash = strrchr(CurDir,'\\');
  18.    if ( NULL == LastBackslash )
  19.       return EXIT_FAILURE;
  20.  
  21.    // if last backslash is only backslash then delete after it, bacause
  22.    // then is root directory, else delete at the backslash
  23.    if ( LastBackslash == strchr(CurDir,'\\') )
  24.       LastBackslash[1] = '\0';
  25.    else
  26.       LastBackslash[0] = '\0';
  27.  
  28.    if ( !(Obj = WinQueryObject(CurDir)) )
  29.       return EXIT_FAILURE;
  30.  
  31.    WinSetObjectData(Obj,"OPEN=DEFAULT;");
  32. }
  33.  
  34.