unicorn commit: creates temporary and uploaded directories if absent

changeset:   1262:cf442294e0ee
user:        Thomas Gambet <tgambet@w3.org>
date:        Thu Jun 17 11:21:11 2010 -0400
files:       src/org/w3c/unicorn/Framework.java
description:
creates temporary and uploaded directories if absent


diff -r 246d99af23f4 -r cf442294e0ee src/org/w3c/unicorn/Framework.java
--- a/src/org/w3c/unicorn/Framework.java	Thu Jun 17 09:10:34 2010 -0400
+++ b/src/org/w3c/unicorn/Framework.java	Thu Jun 17 11:21:11 2010 -0400
@@ -163,7 +163,21 @@
 		} catch (IOException e) {
 			throw new InitializationFailedException("Error reading \"unicorn.properties\": " + e.getMessage());
 		} 
-
+		
+		// creating uploaded and temporary files directories
+		if ((new File(Property.get("UPLOADED_FILES_REPOSITORY"))).mkdir())
+			logger.debug("> Created uploaded files directory: \n\t" 
+				+ Property.get("UPLOADED_FILES_REPOSITORY"));
+		else 
+			throw new InitializationFailedException("Unable to create uploaded files directory: \n\t"
+				+ Property.get("UPLOADED_FILES_REPOSITORY"));
+		if ((new File(Property.get("PATH_TO_TEMPORARY_FILES"))).mkdir())
+			logger.debug("> Created temporary files directory: \n\t" 
+				+ Property.get("PATH_TO_TEMPORARY_FILES"));
+		else 
+			throw new InitializationFailedException("Unable to create temporary files directory: \n\t"
+				+ Property.get("PATH_TO_TEMPORARY_FILES"));
+		
 		// Loading other config files
 		for (String fileName : configFiles) {
 			InputStream confStream = Framework.class.getResourceAsStream("/" + fileName);

Received on Thursday, 17 June 2010 15:24:25 UTC