-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRequestData.java
More file actions
28 lines (26 loc) · 932 Bytes
/
RequestData.java
File metadata and controls
28 lines (26 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.IOException;
import java.nio.file.*;
/**
* @author Sam
*
*/
public class RequestData {
/**
* method takes user input of directory and copies the database there with the password.
* User password still protected as it is hashed at login
* @throws IOException
*/
public void saveData() throws IOException {
//copy the file to a location decided by the user
Path source = Paths.get(System.getProperty("user.dir") + "/ProgramDB.mdb");
System.out.println("Please enter a valid directory for example: C:\\Users\\Public");
String targetInput = App.userIn.readLine();
Path target = Paths.get(targetInput + "/ProgramDB.mdb");
try {
Files.copy(source, target);
System.out.println("File password is: gfg64%43df3*f\"A");
} catch (IOException e1) {
System.out.println("File already exists or path not found");
}
}
}