Newer
Older
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package org.josast.databaseSync.config;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ManageFolder {
private static Logger appLogger = Logger.getLogger("AmsatLogger");
private String RepositoryPath = null;
private String defaultrepository = "data";
public ManageFolder() {
RepositoryPath = System.getProperty("user.dir") + "\\" + defaultrepository;
}
public ManageFolder(String path) {
if (path == null) {
RepositoryPath = System.getProperty("user.dir") + "\\" + defaultrepository;
} else if (path.length() == 0) {
RepositoryPath = System.getProperty("user.dir") + "\\+defaultrepository";
} else {
RepositoryPath = System.getProperty("user.dir") + "\\" + path;
}
}
/**
* @return the repositoryPath
*/
public String getRepositoryPath() {
return RepositoryPath;
}
/**
* @param repositoryPath the repositoryPath to set
*/
public void setRepositoryPath(String repositoryPath) {
RepositoryPath = repositoryPath;
}
public void createdDirectories() {
Path path = Paths.get(RepositoryPath);
// if directory exists?
if (!Files.exists(path)) {
try {
Files.createDirectories(path);
appLogger.info("directory created : " + RepositoryPath);
} catch (IOException e) {
appLogger.log(Level.SEVERE, "cannot create outpout directorie " + e.toString());
}
} else
{
appLogger.info("directory already exist : " + RepositoryPath);
}
}
}