• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is the empty file descriptor a directory?

 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting some behavior from java.io.File that seems to me strange:



So does the empty file descriptor (File("")) represent the current working directory, or not? What am I missing?

[edited to correct "directory" to "file" in the last line of code]
[ November 19, 2004: Message edited by: Warren Dew ]
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Warren Dew:
I'm getting some behavior from java.io.File that seems to me strange:



So does the empty file descriptor (File("")) represent the current working directory, or not? What am I missing?


I'm a little confused by your code. In the last line, I see a variable named directory. However, you didn't post it's declaration or initialization.

I suspect that the first few lines of code are referencing a file named "" in the current working directory. Since the file has a blank name, you don't see it when you print out the absolute path. To get just the current working directory, you should use ".". Most modern operating systems use this convention.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic