public static void loadTree(Task tree, File path) throws Exception {
		/* must be a directory */
		if (!path.isDirectory()) throw new Exception("'" + path.getPath() + "' not a directory");

		File indexFile = new File(path, INDEX_FILE);
		if (indexFile.exists()) {
			/* the index file exists, load nodes based on the index */
			BufferedReader reader = new BufferedReader(new FileReader(indexFile));
			String line;
			
			/* the index is just a list of sub-directories, one per line */
			while ((line = reader.readLine()) != null) {
				if (line.length() == 0) continue;
				File taskFile = new File(path, line);
				Task task = FileSystemTask.load(taskFile);
				if (task != null) {
					tree.add(task);
					
					/* add the children recursively */
					loadTree(task, taskFile);
				}
			}
			reader.close();
		} else {
			/* the node does not exist, load nodes from all suitable sub-directories */
			/* TODO remove support for this in the future */
			File[] files = path.listFiles();
			for (File file : files) {
				if (file.isDirectory()) {
					Task task = FileSystemTask.load(file);
					if (task != null) {
						tree.add(task);

						/* recursively add the children */
						loadTree(task, file);
					}
				}
			}
			/* mark the node dirty, so the task will be saved again and an index will be written */
			tree.setDirty(true);
		}
	}