Reputation: 944
Anyone help me with a formatting issue I have? I have a relative file path that my app uses to copy the file over and save it, such as:
\users\user1\test.pdf
Only problem is if you use %1$s
as your formatter string it will copy this file over as a folder and then save the file in that folder, so you end up with the file name as part of the path, such as:
\users\user1\test.pdf\test.pdf
Anyone know the correct format string to get around this?
Upvotes: 2
Views: 459
Reputation: 460
You should use File objects for handling paths.
File f = new File("test/something");
f.getParent();
f.getName();
etc...
Upvotes: 1