Creating directories.

This commit is contained in:
Winston Li 2014-12-04 18:01:45 +00:00
parent f72767ceb1
commit 1f239d7118
3 changed files with 8 additions and 6 deletions

View file

@ -29,13 +29,15 @@ public class WLDirectoryNode implements PersistentStoreSource, PersistentStoreUp
private Map<String, FileNode> fileNodeTable;
private FileIndexStore fileIndexStore;
public WLDirectoryNode(String projectName, PersistentStoreAPI persistentStore) {
this(projectName);
public WLDirectoryNode(String projectName, File attsDirectory, File rootGitDirectory, PersistentStoreAPI persistentStore) {
this(projectName, attsDirectory, rootGitDirectory);
initFromPersistentStore(persistentStore);
}
private WLDirectoryNode(String projectName) {
private WLDirectoryNode(String projectName, File attsDirectory, File rootGitDirectory) {
this.projectName = projectName;
new File(attsDirectory, projectName).mkdirs();
new File(rootGitDirectory, projectName).mkdirs();
}
private WLDirectoryNode(String projectName, Map<String, FileNode> fileNodeTable, FileIndexStore fileIndexStore) {

View file

@ -43,7 +43,7 @@ public class WLFileStore implements PersistentStoreSource {
public void initFromPersistentStore(PersistentStoreAPI persistentStore) {
this.persistentStore = persistentStore;
for (String projectName : persistentStore.getProjectNames()) {
fileStore.put(projectName, new WLDirectoryNode(projectName, persistentStore));
fileStore.put(projectName, new WLDirectoryNode(projectName, attDirectory, rootGitDirectory, persistentStore));
}
}
@ -92,7 +92,7 @@ public class WLFileStore implements PersistentStoreSource {
private WLDirectoryNode getDirectoryNodeForProjectName(String projectName) {
WLDirectoryNode directoryNode = fileStore.get(projectName);
if (directoryNode == null) {
directoryNode = new WLDirectoryNode(projectName, persistentStore);
directoryNode = new WLDirectoryNode(projectName, attDirectory, rootGitDirectory, persistentStore);
fileStore.put(projectName, directoryNode);
}
return directoryNode;

View file

@ -34,7 +34,7 @@ public class WLDataModel implements CandidateSnapshotCallback {
System.out.println("Loaded file store and index tables.");
List<String> excludedFromDeletion = projectStore.getProjectNames();
excludedFromDeletion.add(".wlgb");
WLFileStore.deleteInDirectoryApartFrom(rootGitDirectory, excludedFromDeletion.toArray(new String[]{}));
WLFileStore.deleteInDirectoryApartFrom(rootGitDirectory, excludedFromDeletion.toArray(new String[] {}));
}
public List<WritableRepositoryContents> updateProjectWithName(String name) throws FailedConnectionException, InvalidProjectException {