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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 | package Torello.JavaDoc;
import Torello.Java.StrCmpr;
import Torello.Java.ReadOnly.ReadOnlyList;
import Torello.Java.Additional.Ret2;
import java.util.Objects;
import java.io.File;
class MainConstructor
{
static Ret2<String, ReadOnlyList<String>> run(
final String rootJavaDocDirectory,
final String... rootSourceFileDirectories
)
{
// System.out.println("rootJavaDocDirectory = [" + rootJavaDocDirectory + "]\n" +
// "rootSourceFileDirectory = [" + rootSourceFileDirectory + "]");
Objects.requireNonNull(
rootJavaDocDirectory,
"You have passed 'null' to parameter 'rootJavaDocDirectory'"
);
Objects.requireNonNull(
rootSourceFileDirectories,
"You have passed 'null' to parameter 'rootSourceFileDirectories'"
);
// NOTE: Java seems to have no problem with '.' and '..' inside of a File-Name
if (StrCmpr.containsOR(rootJavaDocDirectory, "*", "?"))
throw new UpgradeException(
"The Root JavaDoc Directory String you have passed contains either the '*' " +
"character, or the '?', but these is not allowed."
);
// Check for these errors inside the Root Source Directories too.
for (String s : rootSourceFileDirectories) if (StrCmpr.containsOR(s, "*", "?"))
throw new UpgradeException(
"One of the Root Source Directory Strings that you have passed contains either " +
"the '*' character, or the '?', but these is not allowed."
);
if (rootSourceFileDirectories.length == 0) throw new UpgradeException(
"You have not passed any source-code directories to parameter " +
"'rootSourceFileDirectories'"
);
/*
// THIS HAS TO BE MOVED / COPIED
if (rootJavaDocDirectory.length() > 0)
UpgradeException.checkFileExistsAndCanAccess
(rootJavaDocDirectory, "Root '.html' Java-Doc Documentation Page Directory");
*/
for (String rootSourceDir : rootSourceFileDirectories)
if (rootSourceDir.length() > 0)
UpgradeException.checkFileExistsAndCanAccess
(rootSourceDir, "Root '.java' Source File Directory");
// Easier to type "rsd" in the code below
final String[] rsd = new String[rootSourceFileDirectories.length];
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Ensure File.separator is at the end of each of these directory-names - except dir ""
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
//
// If the directory is the "Current Working Directory" - which is specified by the
// Zero-Length-String (a.k.a ""), then a trailing File.separator should **NOT** be added.
// All other directory names must end with the File.separator
//
// NOTE: For checking that a directory exists and can be accessed (the previous lines of
// code), the class java.io.File doesn't require that there be a trailing File
// Separator. However, in this package (the JD-Upgrader Package), appending file
// names to these root-directories mandates that the File-Separator be present at the
// end of each of these directory-names - except, of course, the "" directory - which
// is the "Current Working Directory."
//
// SPECIFICALLY: Later on when these Upgrade-Fields are actually used by the class
// "MainFilesProcessor" - making sure these directory-names end with '/' is
// where this stuff actually comes into play
for (int i=0; i < rootSourceFileDirectories.length; i++)
// DON'T FORGET: This *DOES NOT* end with File.separator - but it doesn't have to!
if (rootSourceFileDirectories[i].length() == 0)
rsd[i] = "";
else if (rootSourceFileDirectories[i].endsWith(File.separator))
rsd[i] = rootSourceFileDirectories[i];
else
rsd[i] = rootSourceFileDirectories[i] + File.separator;
// if (rsd == null) System.out.println("rsd is null!!!");
// else System.out.println(Arrays.toString(rsd));
//
// this.pathsTypesBuilder.rootSourceFileDirectories = ReadOnlyList.of(rsd);
final ReadOnlyList<String> RSFD = ReadOnlyList.of(rsd);
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Make sure the File.separator is here too, unless Root-JD-Dir is the CWD (the "" dir)
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// this.pathsTypesBuilder.rootJavaDocDirectory =
final String RJDD;
// This *DOES NOT* end with File.separator - but it doesn't have to!
if (rootJavaDocDirectory.length() == 0)
RJDD = "";
else if (rootJavaDocDirectory.endsWith(File.separator))
RJDD = rootJavaDocDirectory;
else
RJDD = rootJavaDocDirectory + File.separator;
return new Ret2<String, ReadOnlyList<String>>(RJDD, RSFD);
}
}
|