Skip to main content
edited tags
Link
Mike Christensen
  • 91.8k
  • 52
  • 223
  • 349

Relative path difficoultiesdifficulties

Source Link
ingroxd
  • 1.1k
  • 2
  • 14
  • 29

Relative path difficoulties

I started working with some files, something easy.

I read that the File class support relative paths, so I tried something like:

File file_bg = new File("data\\bg.png"); if(file_bg.exists()) flag_bg = true; 

Ok, now, making some debugging I noticed that every File variable have as parent path the same path where the IDE is, instead of the path where my project is.

Is it a common behavior or I have to set up something before starting the sketch? Is it equal for java IDEs like NetBeans?

One more question, there is a way to keep a String variable in memory that contains the path of my .pde file?

Thanks a lot for the interest, waiting a response!