Hi, let's say I have a program in my external hard drive and there's a code in my app that references a picture or a file in that hard drive, how do I make it so that when I take my external hard drive to another computer, even though the computer assigns a new drive to the hard drive, my code will still find the file/image?

Recommended Answers

All 2 Replies

You could search all the drives.
Use the File class's listRoots() method to get a list of root Files.

In a more structured environment, you could use environment variables to point the external drives or memory sticks. Set them on the new computer and your code can find the stuff it needs via the path in the variable.

Aaaah I see. I'll try that. Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.