From 1f239d711849cc36297d7d2cfa6bd0c25c8fd434 Mon Sep 17 00:00:00 2001 From: Winston Li Date: Thu, 4 Dec 2014 18:01:45 +0000 Subject: [PATCH] Creating directories. --- .../writelatex/filestore/node/WLDirectoryNode.java | 8 +++++--- .../writelatex/filestore/store/WLFileStore.java | 4 ++-- .../ac/ic/wlgitbridge/writelatex/model/WLDataModel.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/node/WLDirectoryNode.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/node/WLDirectoryNode.java index 04ece7f238..b3e9b13ba8 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/node/WLDirectoryNode.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/node/WLDirectoryNode.java @@ -29,13 +29,15 @@ public class WLDirectoryNode implements PersistentStoreSource, PersistentStoreUp private Map 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 fileNodeTable, FileIndexStore fileIndexStore) { diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/store/WLFileStore.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/store/WLFileStore.java index 139a016517..60865185f4 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/store/WLFileStore.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/filestore/store/WLFileStore.java @@ -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; diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java index 2b2556ca54..3ece92980b 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java @@ -34,7 +34,7 @@ public class WLDataModel implements CandidateSnapshotCallback { System.out.println("Loaded file store and index tables."); List excludedFromDeletion = projectStore.getProjectNames(); excludedFromDeletion.add(".wlgb"); - WLFileStore.deleteInDirectoryApartFrom(rootGitDirectory, excludedFromDeletion.toArray(new String[]{})); + WLFileStore.deleteInDirectoryApartFrom(rootGitDirectory, excludedFromDeletion.toArray(new String[] {})); } public List updateProjectWithName(String name) throws FailedConnectionException, InvalidProjectException {