Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

create a file  RSS feed

 
Alex Tang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Using the following code I try to create a new directory on a
Windows platform.
I end up with a subdirectory of my user directory C:/test/MyData
instead of C:/MyData

String dirName = "C:\\MyData";
File dir = new File(dirName);
if(!dir.exists)
dir.mkdir();
Has this something to do with relative paths and absolute paths?
Would anybody help me to understand what is my error?
Thanks,
Alex


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!