X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fproject%2FProject.java;h=265eeff2ae1ce3fcf20fe4dda2ba9dae4d648430;hb=b98dc48989ee78251103c13f9fb48a100febacf5;hp=7a6ee1014355d3438ae1781f6af26fd98a6cc2fe;hpb=4fa04bea2bcb171075208b7fe231dffc99c296d9;p=jSite2.git
diff --git a/src/net/pterodactylus/jsite/project/Project.java b/src/net/pterodactylus/jsite/project/Project.java
index 7a6ee10..265eeff 100644
--- a/src/net/pterodactylus/jsite/project/Project.java
+++ b/src/net/pterodactylus/jsite/project/Project.java
@@ -289,7 +289,7 @@ public class Project extends AbstractBean {
if (!basePathFile.exists() || !basePathFile.isDirectory()) {
return null;
}
- ProjectFileImpl rootProjectFile = new ProjectFileImpl(null, "", true, false);
+ ProjectFileImpl rootProjectFile = new ProjectFileImpl(null, "", 0, true, false);
scanDirectory(basePathFile, rootProjectFile);
return rootProjectFile;
}
@@ -313,7 +313,7 @@ public class Project extends AbstractBean {
return;
}
for (File file: directory.listFiles()) {
- ProjectFileImpl projectFileChild = projectFile.addFile(file.getName(), file.isDirectory(), file.isHidden());
+ ProjectFileImpl projectFileChild = projectFile.addFile(file.getName(), file.length(), file.isDirectory(), file.isHidden());
if (file.isDirectory()) {
scanDirectory(file, projectFileChild);
}
@@ -334,6 +334,9 @@ public class Project extends AbstractBean {
/** The name of this project file. */
private final String name;
+ /** The size of the file. */
+ private final long size;
+
/** Whether this project file is a directory. */
private final boolean directory;
@@ -351,6 +354,8 @@ public class Project extends AbstractBean {
* the new project file does not have a parent
* @param name
* The name of the project file
+ * @param size
+ * The size of the file
* @param isDirectory
* true
if this project file is a directory,
* false
otherwise
@@ -358,9 +363,10 @@ public class Project extends AbstractBean {
* true
if this project file is hidden,
* false
otherwise
*/
- ProjectFileImpl(ProjectFileImpl parentProjectFile, String name, boolean isDirectory, boolean isHidden) {
+ ProjectFileImpl(ProjectFileImpl parentProjectFile, String name, long size, boolean isDirectory, boolean isHidden) {
this.parentProjectFile = parentProjectFile;
this.name = name;
+ this.size = size;
this.directory = isDirectory;
this.hidden = isHidden;
}
@@ -377,6 +383,13 @@ public class Project extends AbstractBean {
}
/**
+ * {@inheritDoc}
+ */
+ public long getSize() {
+ return size;
+ }
+
+ /**
* @see net.pterodactylus.jsite.project.ProjectFile#getParents()
*/
public List getParents() {
@@ -439,6 +452,8 @@ public class Project extends AbstractBean {
*
* @param name
* The name of the file
+ * @param size
+ * The size of the file
* @param isDirectory
* true
if the new file is a directory,
* false
otherwise
@@ -447,8 +462,8 @@ public class Project extends AbstractBean {
* false
otherwise
* @return The created project file
*/
- public ProjectFileImpl addFile(String name, boolean isDirectory, boolean isHidden) {
- ProjectFileImpl newProjectFile = new ProjectFileImpl(this, name, isDirectory, isHidden);
+ public ProjectFileImpl addFile(String name, long size, boolean isDirectory, boolean isHidden) {
+ ProjectFileImpl newProjectFile = new ProjectFileImpl(this, name, size, isDirectory, isHidden);
childProjectFiles.add(newProjectFile);
return newProjectFile;
}