Results 1 to 2 of 2

Thread: cd.. in java

  1. #1
    mm2236 is offline Member
    Join Date
    Sep 2008
    Posts
    9
    Rep Power
    0

    Default cd.. in java

    Hi
    i want to save the user some typing, allow the user to type “..” to mean that the change directory should go up one level to the parent directory.
    for example c:\1\2\3
    if i write ..
    output : c:\1\2

    but my output is c:\

    Java Code:
    private void detailFile(DataInputStream in, ObjectOutputStream oOut) {
            try {
                String fileName = in.readUTF();
    
                File tmp = new File(file, fileName);
    
                if (tmp.isFile()) {
                    oOut.writeObject(tmp);
                } else {
                    oOut.writeObject(null);
                }
    
                fileName = null;
                tmp = null;
            } catch (Exception e) {
                try {
                    oOut.writeObject(null);
                } catch (Exception e2) {
                }
            }
        }
    plz help me
    thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •