generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Java, using mkdir();

Previous Thread :: Next Thread 
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
04 May 2012 03:22 PM
So..

I'd like to use mkdir() to make a file on the current user's Desktop. My only problem is I don't know how to get the path to the user's Desktop without having them put their username or something in. Anyone know?

Code (Just a simple mkdir(); function):

import java.io.*;

public class Filemkdir {
        public static void main(String[] args) {
                File f = new File("C:/hello");
                f.mkdir();
        }
}


- Cheers!
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
04 May 2012 03:23 PM
How can I have the new file go to here for instance:

C:\Users\<​Online User/YOU>\Desktop

- Cheers!
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
04 May 2012 03:26 PM
File f = new File("%userprofile%/Desktop/hello");




Try that?
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
04 May 2012 03:34 PM
Didn't work. :\

(Maybe it's because I was in test mode and didn't compile the program to the real thing?)

- Cheers!
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
04 May 2012 03:35 PM
No clue. Heck, I'm not even sure if Java has access to Windows system environment variables. You could try looking through the FileSystem class; there may be special directory fields in it.
Report Abuse
MrMcAero is not online. MrMcAero
Joined: 21 Apr 2012
Total Posts: 671
04 May 2012 03:38 PM
Got it.

Use a this:

System.getProperty("user.name");

I can get the name of the current user. With that, I can turn that to a string, and then do a simple [ Path + String_Name + Rest of path]



- Cheers!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image